Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id F090047689B for ; Sat, 8 Jun 2002 00:16:12 -0400 (EDT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id C0C06475C6C for ; Sat, 8 Jun 2002 00:14:59 -0400 (EDT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 36F46D60F; Fri, 7 Jun 2002 21:15:01 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 1A4195C01; Fri, 7 Jun 2002 21:15:01 -0700 (PDT) Date: Fri, 7 Jun 2002 21:15:00 -0700 (PDT) From: Stephan Szabo To: Bruce Momjian Cc: Josh Berkus , Andre Schubert , Subject: Re: Indexing timestamps In-Reply-To: <200206080248.g582mPu22554@candle.pha.pa.us> Message-ID: <20020607211334.I43015-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200206/91 X-Sequence-Number: 8056 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.