Re: why is PG NOT pushing where clause to VIEW ? Resulting in bad performance.

From: Herwig Goemans <herwig(dot)goemans(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: why is PG NOT pushing where clause to VIEW ? Resulting in bad performance.
Date: 2017-02-08 10:20:14
Message-ID: CAKaDz_GHq5KTGQ4iFS5g2DrNVZkaBdFZj=eQ-mmWocOuBbQZ_A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)sss(dot)pgh(dot)pa(dot)us>:

Herwig Goemans <herwig(dot)goemans(at)gmail(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Mike Wes 2017-02-08 11:20:35 Problem wil TIMEZONE vs TIME ZONE
Previous Message Tom Lane 2017-02-07 16:37:33 Re: why is PG NOT pushing where clause to VIEW ? Resulting in bad performance.