Re: index compatible date_trunc in postgres?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bryce Nesbitt <bryce2(at)obviously(dot)com>
Cc: sql pgsql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: index compatible date_trunc in postgres?
Date: 2008-12-19 13:32:23
Message-ID: 6850.1229693543@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Bryce Nesbitt <bryce2(at)obviously(dot)com> writes:
> I've got a legacy app that does 8.3 incompatible date searches like so:
> explain select count(*) from contexts where publication_date like '2006%';
> explain select count(*) from contexts where publication_date like
> '2006-09%';

> I've got my choice of refactoring, but all these share the same
> sequential scan limitation:

Why are you worrying? The old method surely didn't get indexed either.

(At least, it didn't unless you had an index on publication_date::text,
in which case just throwing in the cast will produce the same results
in 8.3.)

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2008-12-19 14:03:36 Re: Downgrade database and problem with sequences
Previous Message Alvaro Herrera 2008-12-19 13:06:29 Re: index compatible date_trunc in postgres?