Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g16FU2E58706 for ; Wed, 6 Feb 2002 10:30:03 -0500 (EST) (envelope-from sszabo@megazone23.bigpanda.com) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 68B32D5F9; Wed, 6 Feb 2002 07:29:56 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 5E6185BF8; Wed, 6 Feb 2002 07:29:56 -0800 (PST) Date: Wed, 6 Feb 2002 07:29:56 -0800 (PST) From: Stephan Szabo To: Isabelle Brette Cc: Subject: Re: indexes In-Reply-To: <20020205170524.GA1990@aparima.com> Message-ID: <20020206072840.L16466-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200202/68 X-Sequence-Number: 6498 On Tue, 5 Feb 2002, Isabelle Brette wrote: > As you may also guess, making straight indexes does not work (I still > have this damn Seq Scan while EXPLAINing). For the date, I tried this : > > create index sess_created on sessions (to_char(created,'YYYY/MM')); > > but I get a parse error near "'". What do I have wrong, as the query > seems right ? Is it because of the non-column argument ? For a functional index that you want to pass constants to, right now you'd need to make a cacheable function that takes created in this case and returns the to_char(created, 'YYYY/MM') and then use that in the index and query.