Re: Query slows when used with view

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Yavuz Selim Sertoğlu (ETIYA) <yavuz(dot)sertoglu(at)etiya(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-performance(at)lists(dot)postgresql(dot)org" <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: Query slows when used with view
Date: 2019-10-09 15:24:00
Message-ID: CAMkU=1xgK1pWKFssxOW8unAhvJdA6ub_xcFcCNzUdBGGQKOEYA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Wed, Oct 9, 2019 at 10:56 AM Yavuz Selim Sertoğlu (ETIYA) <
yavuz(dot)sertoglu(at)etiya(dot)com> wrote:

> Thanks for the reply Tom,
>
> Sorry, I couldn't understand. I just copied inside of view and add
> conditions from query that runs with view.
> The comma parts are the same in two queries, one is inside of view the
> other is in the query.
>

When you join to a view, the view sticks together, as if they were all in
parentheses. But when you substitute the text of a view into another
query, then they are all on the same level and can be parsed differently.

Consider the difference between "1+1 * 3", and "(1+1) * 3"

Cheers,

Jeff

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Michael Lewis 2019-10-09 15:32:37 Re: Query slows when used with view
Previous Message Michael Lewis 2019-10-09 15:23:14 Re: Query slows when used with view