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

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 (view raw or flat)
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

pgsql-sql by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group