Re: referring to computed values from the select list in the where and order clauses

From: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
To: Stephen Howard <stephen(at)thunkit(dot)com>
Cc: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: referring to computed values from the select list in the where and order clauses
Date: 2004-03-01 20:30:50
Message-ID: 20040301143050.C20780@mofo.meme.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On 2004.03.01 03:21 Richard Huxton wrote:
> On Monday 01 March 2004 01:04, Stephen Howard wrote:
> > I've got a moderately complex function defined which i then want to
> be
> >
> > able to test the value of, as well as select the value:
> >
> > select id, vector_cosine(document,'[ qw( foo,bar,baz )]') as
> threshold
> > from search_vectorspace where threshold > 0 order by threshold desc;
>
> However, you can mark functions as immutable/stable/volatile which can
> allow
> PG to cache the query results. See the manuals (CREATE FUNCTION) for
> details.

Depending on your requirements you may be able to store the results
in a temporary table CREATE TABLE TEMP ... ; INSERT INTO...

Don't know that this is a better alternative.

Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Robert Treat 2004-03-01 20:38:49 Re: Searches on www.postgresql.org failing
Previous Message Knepper, Michelle 2004-03-01 20:28:47 using the "copy from" command to load tables from a txt flat file