Re: Query slows when used with view

2019-10-09 Thread Tom Lane
Michael Lewis writes: >> 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 *

Re: Query slows when used with view

2019-10-09 Thread Michael Lewis
> > 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" > I

Re: Query slows when used with view

2019-10-09 Thread Jeff Janes
On Wed, Oct 9, 2019 at 10:56 AM Yavuz Selim Sertoğlu (ETIYA) < yavuz.serto...@etiya.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

Re: Query slows when used with view

2019-10-09 Thread Michael Lewis
> > Those are not equivalent queries. Read up on the syntax of FROM; > particularly, that JOIN binds more tightly than comma. > I see this- "A JOIN clause combines two FROM items, which for convenience we will refer to as “tables”, though in reality they can be any type of FROM item. Use

RE: Query slows when used with view

2019-10-09 Thread ETIYA
2019 16:57 To: Yavuz Selim Sertoğlu (ETIYA) Cc: pgsql-performance@lists.postgresql.org Subject: Re: Query slows when used with view =?iso-8859-9?Q?Yavuz_Selim_Serto=F0lu_=28ETIYA=29?= writes: > I have a problem with views. When I use view in my query it really slows > down(1.7seconds) >

Re: Query slows when used with view

2019-10-09 Thread Tom Lane
=?iso-8859-9?Q?Yavuz_Selim_Serto=F0lu_=28ETIYA=29?= writes: > I have a problem with views. When I use view in my query it really slows > down(1.7seconds) > If I use inside of view and add conditions and joins to it, it is really > fast(0.7 milliseconds). > I have no distinct/group/partition by

Query slows when used with view

2019-10-09 Thread ETIYA
Hi all, I have a problem with views. When I use view in my query it really slows down(1.7seconds) If I use inside of view and add conditions and joins to it, it is really fast(0.7 milliseconds). I have no distinct/group/partition by in view so I have no idea why is this happening. I wrote