Lists: | pgsql-tr-genel |
---|
From: | "Cem GULER" <cemguler(at)kibrit(dot)net> |
---|---|
To: | pgsql-tr-genel(at)postgresql(dot)org |
Subject: | date_part vs. extract |
Date: | 2005-07-05 11:20:07 |
Message-ID: | 2229.81.215.194.252.1120562407.squirrel@81.215.194.252 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-tr-genel |
Merhaba arkadaşlar,
PL/pgsql kullanırken bir standart oturtmaya çalışıyorum kendime ve aklıma
takılan bir date-time sorusu var.
Bu sorguların ikisi de aynı değeri döndürüyor. Bunlardan hangisi ileriye
dönük olarak daha performanslıdır?
select extract('day' from now());
select date_part('day', now());
--
iyi calismalar,
Cem GÜLER
cemguler(at)kibrit(dot)net
From: | "Cem GULER" <cemguler(at)kibrit(dot)net> |
---|---|
To: | pgsql-tr-genel(at)postgresql(dot)org |
Subject: | Re: date_part vs. extract |
Date: | 2005-07-05 11:44:29 |
Message-ID: | 2282.81.215.194.252.1120563869.squirrel@81.215.194.252 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-tr-genel |
Arkadaşlar kusura bakmayın Volkan bey'e gönderdiğim cevabı yanlışlıkla
liste yerine Volkan beyin kişisel adresine göndermişim. Bir kopyasını da
buraya göndereyim, Volkan bey ve listeden özür dilerim :)
Selam,
The extract() function is the SQL92 equivalent to PostgreSQL's date_part()
function, with a slightly modified syntax. The SQL syntax for this
function uses the FROM keyword, rather than a comma. The arguments are
similar to those for the date_part() function, though it differs in that
its first argument is a SQL keyword, rather than a character string, and
should therefore not be quoted. Valid values for k are the same as those
listed in Table 5-12.
Note that the extract() function exists as a SQL92 syntax "alias" for the
PostgreSQL date_part() function; for this reason, the output column name
from PostgreSQL is, by default, date_ part.
Demekki date_part kullanıyormuşuz, çünkü internal mış. Buradan çıkacak
sonuç ise "equivalent" yani dengi kelimesinin "aynı" kelimesi ile aynı
manaya gelmediği. Yüklü ya da yoğun olarak tabir edebileceğimiz
sunucularda sunucu yazılımını bir de "aliasing" ile uğraştırmamak en iyisi
bence.
On 5 Temmuz 2005, Salı, 15:36, Volkan YAZICI dedi ki:
> Merhaba,
>
> On 7/5/05, Cem GULER <cemguler(at)kibrit(dot)net> wrote:
>> Bu sorguların ikisi de aynı değeri döndürüyor. Bunlardan hangisi ileriye
>> dönük olarak daha performanslıdır?
>>
>> select extract('day' from now());
>> select date_part('day', now());
>
> http://www.postgresql.org/docs/8.0/interactive/functions-datetime.html
> adresinden tablo 9.26'da date_part() fonksiyonunun açıklamasına
> baktığımız zaman, "Get subfield (equivalent to extract); see Section
> 9.9.1" yazar.
>
> İyi çalışmalar.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
--
iyi calismalar,
Cem GÜLER
cemguler(at)kibrit(dot)net
From: | "Cem GULER" <cemguler(at)kibrit(dot)net> |
---|---|
To: | pgsql-tr-genel(at)postgresql(dot)org |
Subject: | Re: date_part vs. extract |
Date: | 2005-07-05 11:47:49 |
Message-ID: | 2309.81.215.194.252.1120564069.squirrel@81.215.194.252 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-tr-genel |
Selam,
Arkadaşlar bu maili yanlışlıkla Volkan bey'e göndermiştim, şimdi listeye
gönderiyorum herkesten özür dilerim :)
Selam,
The extract() function is the SQL92 equivalent to PostgreSQL's date_part()
function, with a slightly modified syntax. The SQL syntax for this
function uses the FROM keyword, rather than a comma. The arguments are
similar to those for the date_part() function, though it differs in that
its first argument is a SQL keyword, rather than a character string, and
should therefore not be quoted. Valid values for k are the same as those
listed in Table 5-12.
Note that the extract() function exists as a SQL92 syntax "alias" for the
PostgreSQL date_part() function; for this reason, the output column name
from PostgreSQL is, by default, date_ part.
Demekki date_part kullanıyormuşuz, çünkü internal mış. Buradan çıkacak
sonuç ise "equivalent" yani dengi kelimesinin "aynı" kelimesi ile aynı
manaya gelmediği. Yüklü ya da yoğun olarak tabir edebileceğimiz
sunucularda sunucu yazılımını bir de "aliasing" ile uğraştırmamak en iyisi
bence.
On 5 Temmuz 2005, Salı, 15:36, Volkan YAZICI dedi ki:
> Merhaba,
>
> On 7/5/05, Cem GULER <cemguler(at)kibrit(dot)net> wrote:
>> Bu sorguların ikisi de aynı değeri döndürüyor. Bunlardan hangisi ileriye
>> dönük olarak daha performanslıdır?
>>
>> select extract('day' from now());
>> select date_part('day', now());
>
> http://www.postgresql.org/docs/8.0/interactive/functions-datetime.html
> adresinden tablo 9.26'da date_part() fonksiyonunun açıklamasına
> baktığımız zaman, "Get subfield (equivalent to extract); see Section
> 9.9.1" yazar.
>
> İyi çalışmalar.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
--
iyi calismalar,
Cem GÜLER
cemguler(at)kibrit(dot)net
From: | "Cem GULER" <cemguler(at)kibrit(dot)net> |
---|---|
To: | "Volkan YAZICI" <volkan(dot)yazici(at)gmail(dot)com> |
Cc: | pgsql-tr-genel(at)postgresql(dot)org |
Subject: | Re: date_part vs. extract |
Date: | 2005-07-05 12:31:18 |
Message-ID: | 2420.81.215.194.252.1120566678.squirrel@81.215.194.252 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-tr-genel |
Eh bu cevap daha tatminkar teşekkürler :)
On 5 Temmuz 2005, Salı, 16:28, Volkan YAZICI dedi ki:
> Merhaba,
>
> On 7/5/05, Cem GULER <cemguler(at)kibrit(dot)net> wrote:
>> The extract() function is the SQL92 equivalent to PostgreSQL's
>> date_part()
>> function, with a slightly modified syntax. The SQL syntax for this
>> function uses the FROM keyword, rather than a comma. The arguments are
>> similar to those for the date_part() function, though it differs in that
>> its first argument is a SQL keyword, rather than a character string, and
>> should therefore not be quoted. Valid values for k are the same as those
>> listed in Table 5-12.
>>
>> Note that the extract() function exists as a SQL92 syntax "alias" for
>> the
>> PostgreSQL date_part() function; for this reason, the output column name
>> from PostgreSQL is, by default, date_ part.
>>
>> Demekki date_part kullanıyormuşuz, çünkü internal mış. Buradan çıkacak
>> sonuç ise "equivalent" yani dengi kelimesinin "aynı" kelimesi ile aynı
>> manaya gelmediği.
>
> Hayır, buradan böyle bir mana çıkmıyor.
>
>> Yüklü ya da yoğun olarak tabir edebileceğimiz
>> sunucularda sunucu yazılımını bir de "aliasing" ile uğraştırmamak en
>> iyisi
>> bence.
>
> Açıkcası burada hemfikir değilim. PostgreSQL'in şuanki CVS HEAD'inde
> bulunan kaynak kodundan baktığım kadarı ile date_part() fonksiyonu ile
> EXTRACT ifadesinin ilgili fonksiyon çağrıları aynı şekilde bağlanmış.
> Yani işler düşündüğünüz kadar "alias extract=date_part" şeklinde
> yüzeysel değil. Kabaca izah edecek olursam, işlem şöyle gerçekleşiyor:
>
> 1. Dosyayı parse et.
> 2. EXTRACT ve date_part ifadelerini bul
> 3. date_part'ın uygun alt alias fonksiyonunu çağır.
>
> Yani sonuç itibari ile date_part için de başka alt fonksiyonlara bir
> alias tanımlı. Bunun dışında anladığım kadarı ile herhangi bir
> performans kazancı kaydetmeniz olası gözükmüyor. Çünkü iki işaretçi
> de, başka bir işaretçinin alt işaretçilerini gösteriyor.
>
> Bence burada dikkat edilmesi gereken hangisinin çoğu SQL standardı
> tarafından desteklendiği.
>
> İyi çalışmalar.
> adresine yollayabilirsiniz.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
--
iyi calismalar,
Cem GÜLER
cemguler(at)kibrit(dot)net
From: | Volkan YAZICI <volkan(dot)yazici(at)gmail(dot)com> |
---|---|
To: | cemguler(at)kibrit(dot)net |
Cc: | pgsql-tr-genel(at)postgresql(dot)org |
Subject: | Re: date_part vs. extract |
Date: | 2005-07-05 12:36:16 |
Message-ID: | 7104a737050705053624f5c7ed@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-tr-genel |
Merhaba,
On 7/5/05, Cem GULER <cemguler(at)kibrit(dot)net> wrote:
> Bu sorguların ikisi de aynı değeri döndürüyor. Bunlardan hangisi ileriye
> dönük olarak daha performanslıdır?
>
> select extract('day' from now());
> select date_part('day', now());
http://www.postgresql.org/docs/8.0/interactive/functions-datetime.html
adresinden tablo 9.26'da date_part() fonksiyonunun açıklamasına
baktığımız zaman, "Get subfield (equivalent to extract); see Section
9.9.1" yazar.
İyi çalışmalar.
From: | Volkan YAZICI <volkan(dot)yazici(at)gmail(dot)com> |
---|---|
To: | cemguler(at)kibrit(dot)net |
Cc: | pgsql-tr-genel(at)postgresql(dot)org |
Subject: | Re: date_part vs. extract |
Date: | 2005-07-05 13:28:28 |
Message-ID: | 7104a737050705062860af1d0d@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-tr-genel |
Merhaba,
On 7/5/05, Cem GULER <cemguler(at)kibrit(dot)net> wrote:
> The extract() function is the SQL92 equivalent to PostgreSQL's date_part()
> function, with a slightly modified syntax. The SQL syntax for this
> function uses the FROM keyword, rather than a comma. The arguments are
> similar to those for the date_part() function, though it differs in that
> its first argument is a SQL keyword, rather than a character string, and
> should therefore not be quoted. Valid values for k are the same as those
> listed in Table 5-12.
>
> Note that the extract() function exists as a SQL92 syntax "alias" for the
> PostgreSQL date_part() function; for this reason, the output column name
> from PostgreSQL is, by default, date_ part.
>
> Demekki date_part kullanıyormuşuz, çünkü internal mış. Buradan çıkacak
> sonuç ise "equivalent" yani dengi kelimesinin "aynı" kelimesi ile aynı
> manaya gelmediği.
Hayır, buradan böyle bir mana çıkmıyor.
> Yüklü ya da yoğun olarak tabir edebileceğimiz
> sunucularda sunucu yazılımını bir de "aliasing" ile uğraştırmamak en iyisi
> bence.
Açıkcası burada hemfikir değilim. PostgreSQL'in şuanki CVS HEAD'inde
bulunan kaynak kodundan baktığım kadarı ile date_part() fonksiyonu ile
EXTRACT ifadesinin ilgili fonksiyon çağrıları aynı şekilde bağlanmış.
Yani işler düşündüğünüz kadar "alias extract=date_part" şeklinde
yüzeysel değil. Kabaca izah edecek olursam, işlem şöyle gerçekleşiyor:
1. Dosyayı parse et.
2. EXTRACT ve date_part ifadelerini bul
3. date_part'ın uygun alt alias fonksiyonunu çağır.
Yani sonuç itibari ile date_part için de başka alt fonksiyonlara bir
alias tanımlı. Bunun dışında anladığım kadarı ile herhangi bir
performans kazancı kaydetmeniz olası gözükmüyor. Çünkü iki işaretçi
de, başka bir işaretçinin alt işaretçilerini gösteriyor.
Bence burada dikkat edilmesi gereken hangisinin çoğu SQL standardı
tarafından desteklendiği.
İyi çalışmalar.