Re: [SQL] why is PG NOT pushing where clause to VIEW ? Resulting inbad performance. - Mailing list pgsql-sql

From Herwig Goemans
Subject Re: [SQL] why is PG NOT pushing where clause to VIEW ? Resulting inbad performance.
Date
Msg-id CAKaDz_GHq5KTGQ4iFS5g2DrNVZkaBdFZj=eQ-mmWocOuBbQZ_A@mail.gmail.com
Whole thread Raw
In response to Re: [SQL] why is PG NOT pushing where clause to VIEW ? Resulting in bad performance.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Hello,

I do not see how pushing this clause to to the view can alter in any way the result. If the latter is true, it is obvious to implement this. A short test without data in another database showed no change in plan with or without the extra clause, in fact it said access predicates on currency view on ID and on wsid. So it looks to me this is a opportunity for PG to add these predicates. The benefit performante wise is huge: the query goes down from 4-6s elapsed time to less than 1s.
Kind regards and thanks for the help.
Herwig


Op 7 feb. 2017 5:37 p.m. schreef "Tom Lane" <tgl@sss.pgh.pa.us>:
Herwig Goemans <herwig.goemans@gmail.com> writes:
> I am wondering why a certain query is NOT pushing the where clause to the
> view. See query and explain plan:

There's no provision for transitively applying IN clauses to other
variables.  I'm not entirely sure whether it would be a good idea,
but in any case, it's not there and not planned.

                        regards, tom lane

pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: [SQL] why is PG NOT pushing where clause to VIEW ? Resulting in bad performance.
Next
From: Mike Wes
Date:
Subject: [SQL] Problem wil TIMEZONE vs TIME ZONE