Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

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: Fri, 19 Dec 2008 08:32:23 -0500
  • Message-id: <6850.1229693543@sss.pgh.pa.us> <text/plain>

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



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group