Re: INDEXng date_trunc ...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brent Verner <brent(at)rcfile(dot)org>
Cc: "Marc G(dot) Fournier" <scrappy(at)hub(dot)org>, pgsql-sql(at)postgresql(dot)org
Subject: Re: INDEXng date_trunc ...
Date: 2001-11-22 17:29:02
Message-ID: 1433.1006450142@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Brent Verner <brent(at)rcfile(dot)org> writes:
> ... I'm curious
> why we can't take a constant as an argument to an indexed function...

It's a representational limitation in pg_index: what's stored is a
function OID and a list of column numbers that are its arguments.
There's noplace to put any constant arguments.

I've been toying with the notion of replacing "functional indexes"
with "expressional indexes", wherein the value to be indexed is
computed by any SQL expression (probably refusing subselects and
aggregates though; the restrictions would be the same as for CHECK
constraint expressions). Other than breaking nigh everything that
looks at pg_index, this seems doable enough, and much more efficient
than writing SQL-language helper functions to accomplish the result.
(SQL-language functions work, but the call overhead is depressing.)

Haven't got round to it yet though ...

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Roberto Mello 2001-11-22 21:01:22 Re: Generate GUID in postgresql
Previous Message Stephan Szabo 2001-11-22 17:01:22 Re: How are working index with date ?