Re: [GENERAL] Slow lookups on dates? Or something else?

From: "Aaron J(dot) Seigo" <aaron(at)gtv(dot)ca>
To: swalton(at)galileo(dot)csun(dot)edu, Stephen Walton <swalton(at)galileo(dot)csun(dot)edu>, pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] Slow lookups on dates? Or something else?
Date: 1999-10-25 19:33:48
Message-ID: 99102513345202.00882@stilborne
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi...

> Many of the lookups I have to do on this database are on the date, in
> particular on date_trunc('day',date). Such lookups seem much slower
> (5-10x) than they were on mSQL against the yyyymmdd field, with both
> servers on the same hardware. Is this inherent in the format, or is
> PostgreSQL that much slower? If the format is the problem, is there some
> way of adding a field to my table which would be automatically set equal
> to date_trunc('day',date) whenever the date field was set or updated? Or
> should I look elsewhere for performance improvements?

my experience has been that this:

select date_time_field::date from table_name;

is much faster than:

select date_trunc('day',date) from table_name;

perhaps it's just me @;-)

--
Aaron J. Seigo
Sys Admin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Courtney Thomas 1999-10-25 22:39:42 initdb error->ld-elf.so.1: Shared object "libpq.so.2" not found
Previous Message Bob Kline 1999-10-25 18:55:45 Re: [GENERAL] Slow lookups on dates? Or something else?