pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Michael Glaesmann <grzm@myrealbox.com>
To: pgsql-novice@postgresql.org
Subject: Re: Functional index problems. (Was: Many joins: monthly summaries S-L--O--W)
Date: Wed, 22 Oct 2003 10:53:56 -0700
Message-ID: <200310221053.56665.josh@agliodbs.com> (raw)
In-Reply-To: <461424BA-04B2-11D8-81AE-0005029FC1A7@myrealbox.com>
References: <461424BA-04B2-11D8-81AE-0005029FC1A7@myrealbox.com>
Michael,
> What is that simple thing I'm overlooking? Any ideas what else I should
> check? (I did a search on 'functional index' in the list archives but
> kept getting timed out :(
Oh, sorry. There's an implementation issue with funcional indexes, where they
can't take parameters other than column names. So you need to do:
CREATE FUNCTION get_month (
TIMESTAMPTZ ) RETURNS INTEGER AS
' SELECT EXTRACT(MONTH from $1); '
LANGUAGE sql IMMUTABLE STRICT;
Then do
CREATE INDEX dborders_date_trunc_idx on dborders
(get_month(date));
--
-Josh Berkus
Aglio Database Solutions
San Francisco
view thread (9+ messages) latest in thread
Message-ID: <200310221053.56665.josh@agliodbs.com> Permalink: ../200310221053.56665.josh@agliodbs.com/ Also on: postgresql.org/message-id/200310221053.56665.josh@agliodbs.com ·
reply
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Reply to all the recipients using the --to and --cc options: reply via email To: pgsql-sql@postgresql.org Cc: josh@agliodbs.com, grzm@myrealbox.com, pgsql-novice@postgresql.org Subject: Re: Functional index problems. (Was: Many joins: monthly summaries S-L--O--W) In-Reply-To: <200310221053.56665.josh@agliodbs.com> * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox