Re: Push predicate down in view containing window function - Mailing list pgsql-general

From Philippe Girolami
Subject Re: Push predicate down in view containing window function
Date
Msg-id 0dfniv0mh4w3fch9o8doytdn.1384497808896@email.android.com
Whole thread Raw
In response to Re: Push predicate down in view containing window function  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Push predicate down in view containing window function
List pgsql-general
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 ? 

Thanks.

Tom Lane <tgl@sss.pgh.pa.us> a écrit :


Philippe Girolami <philippe.girolami@sensorly.com> writes:
> Hello,
> Using postgres 9.1.9, I have a view that uses a window function. I then query that view with a predicate on one of
thecolumns. Unfortunately, the predicate doesn't get pushed down into the view. 
> Given that the predicate applies to a column that's being partitionned on, why wouldn't the optimizer push the
predicatedown ? 

Because there is zero optimization around window functions right now.
It certainly isn't smart enough to decide that it'd be safe to push
down a constraint that only mentions partitioning columns.

                        regards, tom lane


pgsql-general by date:

Previous
From: Amit Langote
Date:
Subject: Re: pg_trgm module: no convertion into Trigrams on one side when comparing
Next
From: Tony Theodore
Date:
Subject: Composite types or composite keys?