Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 91CE9475B13 for ; Fri, 7 Jun 2002 22:48:41 -0400 (EDT) Received: from candle.pha.pa.us (216-55-132-35.dsl.san-diego.abac.net [216.55.132.35]) by postgresql.org (Postfix) with ESMTP id 9A19D475A44 for ; Fri, 7 Jun 2002 22:48:39 -0400 (EDT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id g582mPu22554; Fri, 7 Jun 2002 22:48:25 -0400 (EDT) From: Bruce Momjian Message-Id: <200206080248.g582mPu22554@candle.pha.pa.us> Subject: Re: Indexing timestamps In-Reply-To: <20020606152814.P30776-100000@megazone23.bigpanda.com> To: Stephan Szabo Date: Fri, 7 Jun 2002 22:48:25 -0400 (EDT) Cc: Josh Berkus , Andre Schubert , pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL97 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Archive-Number: 200206/87 X-Sequence-Number: 8052 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. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026