RE: Alias in WHERE clause - Mailing list pgsql-general

From Eric Jain
Subject RE: Alias in WHERE clause
Date
Msg-id NCBBJFHBEGOIAHBCBNCLKEAACFAA.jain@gmx.net
Whole thread Raw
In response to Re: Alias in WHERE clause  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Alias in WHERE clause
List pgsql-general
> If it's that expensive you might consider computing and storing the
> results as an additional column in your table ... then you'd not
> have to re-evaluate it for every tuple on each SELECT ...

Thanks... Unfortunatly the 'term' will be different for every query I
can't store any precomputed values. However I figure I could do the
following for every query:

SELECT url,score_a(text, CAST('term' AS TEXT)) AS score
INTO TEMP scores
FROM articles;

SELECT url,score
FROM scores
WHERE score > 0
ORDER BY score DESC;


Now I just hope this won't cause any problems if several users try to
issue different queries at the same time?


--
Eric Jain


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: rules on INSERT can't UPDATE new instance?
Next
From: Tom Lane
Date:
Subject: Re: Alias in WHERE clause