Re: [GENERAL] Slow lookups on dates? Or something else? - Mailing list pgsql-general

From Aaron J. Seigo
Subject Re: [GENERAL] Slow lookups on dates? Or something else?
Date
Msg-id 99102513345202.00882@stilborne
Whole thread Raw
In response to Slow lookups on dates? Or something else?  (Stephen Walton <swalton@galileo.csun.edu>)
Responses Re: [GENERAL] Slow lookups on dates? Or something else?
List 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

pgsql-general by date:

Previous
From: Bob Kline
Date:
Subject: Re: [GENERAL] Slow lookups on dates? Or something else?
Next
From: "amy cheng"
Date:
Subject: current_timestamp and default now()