RE: Query slows when used with view - Mailing list pgsql-performance

From Yavuz Selim Sertoğlu (ETIYA)
Subject RE: Query slows when used with view
Date
Msg-id AM6PR01MB4817847CE14487DF685CE0049B950@AM6PR01MB4817.eurprd01.prod.exchangelabs.com
Whole thread Raw
In response to Re: Query slows when used with view  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Query slows when used with view  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-performance
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.


-----Original Message-----
From: Tom Lane <tgl@sss.pgh.pa.us>
Sent: 09 October 2019 16:57
To: Yavuz Selim Sertoğlu (ETIYA) <yavuz.sertoglu@etiya.com>
Cc: pgsql-performance@lists.postgresql.org
Subject: Re: Query slows when used with view

=?iso-8859-9?Q?Yavuz_Selim_Serto=F0lu_=28ETIYA=29?= <yavuz.sertoglu@etiya.com> 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 in view so I have no idea why is this happening.
> I wrote queries and plans below.

Those are not equivalent queries.  Read up on the syntax of FROM;
particularly, that JOIN binds more tightly than comma.

regards, tom lane
[http://www.etiya.com/images/e-newsletter/signature/e_logo_1.png]
[http://www.etiya.com/images/e-newsletter/signature/e_adres.png]<http://www.etiya.com>
[http://www.etiya.com/images/e-newsletter/signature/facebook_icon.png]<https://www.facebook.com/Etiya-249050755136326/>
[http://www.etiya.com/images/e-newsletter/signature/linkedin_icon.png]
<https://www.linkedin.com/company/etiya?trk=tyah&trkInfo=tas%3Aetiya%2Cidx%3A1-1-1>
[http://www.etiya.com/images/e-newsletter/signature/instagram_icon.png]<https://www.instagram.com/etiya_/>
[http://www.etiya.com/images/e-newsletter/signature/youtube_icon.png]
<https://www.youtube.com/channel/UCWjknu72sHoKKt2nujuU2kA>
[http://www.etiya.com/images/e-newsletter/signature/twitter_icon.png]<https://twitter.com/etiya_> 
[http://www.etiya.com/images/e-newsletter/signature/0.png]

Yavuz Selim Sertoğlu
Solution Support Specialist II

T:+90 312 265 01 50
M:+90 552 997 52 02
E:yavuz.sertoglu@etiya.com<mailto:yavuz.sertoglu@etiya.com>

Üniversiteler Mahallesi 1606.cadde No:4 Cyberpark C Blok Zemin kat ofis no :Z25A-Z44
[http://www.etiya.com/images/e-newsletter/signature/tmf_award.jpg]
<https://www.etiya.com/press/view/etiya-wins-tm-forum-excellence-award-for-disruptive-innovation>


Yasal Uyari :
Bu elektronik posta asagidaki adreste bulunan Kosul ve Sartlara tabidir;
http://www.etiya.com/gizlilik<www.etiya.com/gizlilik>

ÇIKTI ALMADAN ÖNCE ÇEVREYE OLAN SORUMLULUGUMUZU BIR KEZ DAHA DÜSÜNELIM.
PLEASE CONSIDER THE ENVIRONMENT BEFORE PRINTING ANY DOCUMENT.



pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Query slows when used with view
Next
From: Michael Lewis
Date:
Subject: Re: Query slows when used with view