Search Postgresql Archives

Re: Optimize expresiions.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



han.holl@xxxxxxxxxxxxxxxxxxxx wrote:
Now the query:
select item from aview where exp > 0 and cheap > 0;
will lead to a sequential scan on atable with filter: very_expensive_function(item) > 0 and cheap_function(item) > 0

The query would run much faster with the filter reordered.
Is there a way to tell the planner/optimizer that certain functions are more expensive than others, and should be postponed in lazy evaluation ? Or is there a hook in the system that would allow me too look at and maybe reorder expressions before they are executed ?

Not really. Perhaps look into using a functional/expressional index and see if that does the job for you.

http://www.postgresql.org/docs/8.2/static/indexes-expressional.html
http://www.postgresql.org/docs/8.2/static/sql-createfunction.html

--
  Richard Huxton
  Archonet Ltd


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux