Re: index compatible date_trunc in postgres?

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
Cc: Bryce Nesbitt <bryce2(at)obviously(dot)com>, sql pgsql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: index compatible date_trunc in postgres?
Date: 2008-12-19 13:06:29
Message-ID: 20081219130628.GD4278@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Scott Marlowe escribió:
> On Thu, Dec 18, 2008 at 10:46 PM, Bryce Nesbitt <bryce2(at)obviously(dot)com> wrote:
> > 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%';

> You can create an index on date_trunc (on timestamp without timezone,
> but not on timestamp with timezone since it's not immutable)

But you can create an index on the timestamptz AT TIME ZONE 'GMT', I
think.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2008-12-19 13:32:23 Re: index compatible date_trunc in postgres?
Previous Message Sebastian Rychter 2008-12-19 13:03:42 Downgrade database and problem with sequences