Search Postgresql Archives

Re: Push predicate down in view containing window function

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

 



On Fri, Nov 15, 2013 at 12:43 AM, Philippe Girolami
<philippe.girolami@xxxxxxxxxxxx> wrote:
> Ok so is there a way i can do something similar ? Would a function returning rows and taking the extra predicate 'values' as parameters be as optimized as the 'good' query in my first email ?

There is only one way I know of to do it (force a qual into a view
wrapped into a subquery).  It's tweaky, particularly with pre-9.3
LATERAL.  The basic MO is to put the window function into SQL function
in order to be able to force the qual into the inner query with a
function parameter.  Then, you make a view that cross products the
possible arguments to the function and LATERALS them into the set
returning function (it's possible, but difficult, to do it without
lateral).  As long as the 'arguments' expressed in the view are always
specified in the query that hits the view performance should be good.

If this sounds like something you'd like to tackle, maybe I can work
up an example.

merlin


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[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