Re: 7.4 Wishlist
| От | Stephan Szabo |
|---|---|
| Тема | Re: 7.4 Wishlist |
| Дата | |
| Msg-id | 20021202212110.X64892-100000@megazone23.bigpanda.com обсуждение исходный текст |
| Ответ на | Re: 7.4 Wishlist ("Magnus Naeslund(f)" <mag@fbab.net>) |
| Список | 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.
В списке pgsql-hackers по дате отправления: