Обсуждение: date_part vs extract

Поиск
Список
Период
Сортировка

date_part vs extract

От
Markus Bertheau
Дата:
I wonder about the difference between date_part('week', ...) and
extract(week from ...) not only but also from a performance point of
view. I read extract is standard and date_part is not. Backwards
compatibility maybe justifies the existence of date_part. Whats else?

Markus Bertheau

Re: date_part vs extract

От
Brent Verner
Дата:
On 29 Nov 2001 at 09:45 (+0100), Markus Bertheau wrote:
| I wonder about the difference between date_part('week', ...) and
| extract(week from ...) not only but also from a performance point of
| view. I read extract is standard and date_part is not. Backwards
| compatibility maybe justifies the existence of date_part. Whats else?

The EXTRACT syntax ends up as a call to the internal date_part(...) 
function.  If SQL-portability is not a concern, calling date_part()
directly should be a bit quicker.

cheers. brent


-- 
"Develop your talent, man, and leave the world something. Records are 
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing."  -- Duane Allman


Re: date_part vs extract

От
Peter Eisentraut
Дата:
Markus Bertheau writes:

> I wonder about the difference between date_part('week', ...) and
> extract(week from ...) not only but also from a performance point of
> view. I read extract is standard and date_part is not. Backwards
> compatibility maybe justifies the existence of date_part. Whats else?

I think date_part() was adapted from Ingres.  Btw., note that the "week"
parameter (and most others) aren't standard either.

-- 
Peter Eisentraut   peter_e@gmx.net



Re: date_part vs extract

От
Bruce Momjian
Дата:
> Markus Bertheau writes:
> 
> > I wonder about the difference between date_part('week', ...) and
> > extract(week from ...) not only but also from a performance point of
> > view. I read extract is standard and date_part is not. Backwards
> > compatibility maybe justifies the existence of date_part. Whats else?
> 
> I think date_part() was adapted from Ingres.  Btw., note that the "week"
> parameter (and most others) aren't standard either.

Yes, from Ingres.  I think Thomas added it.  Both he and I have Ingres
experience.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026