Re: Indexing timestamps

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, Andre Schubert <andre(dot)schubert(at)km3(dot)de>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Indexing timestamps
Date: 2002-06-08 04:15:00
Message-ID: 20020607211334.I43015-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, 7 Jun 2002, Bruce Momjian wrote:

> Stephan Szabo wrote:
> > On Thu, 6 Jun 2002, Josh Berkus wrote:
> >
> > >
> > > Stephan,
> > >
> > > > Unfortunately you can't do that in that sort of syntax. You'll
> > > > need to create a function that returns the month and is marked
> > > > as iscachable and use that function in the index creation and
> > > > query.
> > >
> > > Hmmm. I take it that NOW() is not ISCACHABLE, and that's Andre's indexing
> > > problem? What would be the pitfall of creating an alternate version of
> > > NOW() that ISCACHABLE?
> >
> > I believe it was not marked as iscachable. I think it's now marked as
> > static in dev sources which I would guess would mean that it could
> > consider an index scan. I think with care an iscachable function that
> > just called now() would probably be safe for interactive queries.
>
> We have all those new cacheable settings now to indicate things that can
> change during the transaction, function call, or never.

Yeah, it's marked static now. The comments implied that meant constant
for a particular scan which I'd guess means index scans are safe but I
didn't go looking through code or try examples to verify that.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Gunther Schadow 2002-06-09 17:07:35 Q: will GROUP BY make use of an index to return tuples early?
Previous Message Bruce Momjian 2002-06-08 02:53:06 Re: [HACKERS] PostgreSQL on AIX