Karel Zak - Zakkr <zakkr@zf.jcu.cz> writes:
> *Very* simpl test over 10000 rows:
> $ time psql test -c "select date_part('second', d)
> from dtest;" -o /dev/null
> real 0m0.504s
> user 0m0.100s
> sys 0m0.000s
> $ time psql test -c "select to_char(d, 'SI') from
> dtest;" -o /dev/null
> real 0m0.288s
> user 0m0.100s
> sys 0m0.000s
That isn't necessarily an impressive demonstration --- what is the data
type of your "d" column? Four of the six variants of date_part() are
implemented as SQL functions, which naturally adds a lot of overhead...
regards, tom lane