Re: index compatible date_trunc in postgres? - Mailing list pgsql-sql

From Tom Lane
Subject Re: index compatible date_trunc in postgres?
Date
Msg-id 6850.1229693543@sss.pgh.pa.us
Whole thread Raw
In response to index compatible date_trunc in postgres?  (Bryce Nesbitt <bryce2@obviously.com>)
Responses Re: index compatible date_trunc in postgres?  (Bryce Nesbitt <bryce2@obviously.com>)
List pgsql-sql
Bryce Nesbitt <bryce2@obviously.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


pgsql-sql by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: index compatible date_trunc in postgres?
Next
From: "Sebastian Rychter"
Date:
Subject: Downgrade database and problem with sequences