From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | "Magnus Naeslund(f)" <mag(at)fbab(dot)net> |
Cc: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: 7.4 Wishlist |
Date: | 2002-12-03 05:28:39 |
Message-ID: | 20021202212110.X64892-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-advocacy pgsql-general pgsql-hackers |
On Tue, 3 Dec 2002, Magnus Naeslund(f) wrote:
> Now convert this query so that it only evaluates the date_part thing
> ONCE:
That's not a good idea as long as t.stamp varies from row to row. ;)
Perhaps once per row, maybe... :)
> select t.id, date_part('days',now()-t.stamp) from table_name t where
> date_part('days',now()-t.stamp) > 20;
Potentially I think something like this would do it:
select t.id, t.foo from (select id, date_part('days', now()-stamp)
as foo from table_name except select null, null) as t where foo>20;
It's not really an optimization given the required except, but if there
was some way to tell the system not to push clauses down into a subselect
you wouldn't even need that.
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Naeslund(f) | 2002-12-03 05:31:52 | Re: 7.4 Wishlist |
Previous Message | Bruce Momjian | 2002-12-03 05:27:03 | Re: 7.4 Wishlist |
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Naeslund(f) | 2002-12-03 05:31:52 | Re: 7.4 Wishlist |
Previous Message | Bruce Momjian | 2002-12-03 05:27:03 | Re: 7.4 Wishlist |
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Naeslund(f) | 2002-12-03 05:31:52 | Re: 7.4 Wishlist |
Previous Message | Bruce Momjian | 2002-12-03 05:27:03 | Re: 7.4 Wishlist |