pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas Kretschmer <andreas@a-kretschmer.de>
To: pgsql-general@lists.postgresql.org
Subject: Re: CTE with JOIN of two tables is much faster than a regular query
Date: Sat, 18 Aug 2018 12:26:30 +0200
Message-ID: <42ce9b74-0671-ecba-3deb-dc8bc8d5e9b3@a-kretschmer.de> (raw)
In-Reply-To: <004b01d436d6$ff96c840$fec458c0$@gmail.com>
References: <004b01d436d6$ff96c840$fec458c0$@gmail.com>



Am 18.08.2018 um 11:36 schrieb kpi6288@gmail.com:
> What can I do to improve the performance of the regular query without 
> using a CTE? 

try to rewrite it to a subselect:

select ... from ... join (selec ... from ... where ...) x on ...


Regards, Andreas

-- 
2ndQuadrant - The PostgreSQL Support Company.
www.2ndQuadrant.com





view thread (5+ messages)  latest in thread

Message-ID: <42ce9b74-0671-ecba-3deb-dc8bc8d5e9b3@a-kretschmer.de>
Permalink:  ../42ce9b74-0671-ecba-3deb-dc8bc8d5e9b3@a-kretschmer.de/
Also on:    postgresql.org/message-id/42ce9b74-0671-ecba-3deb-dc8bc8d5e9b3@a-kretschmer.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: andreas@a-kretschmer.de
  Subject: Re: CTE with JOIN of two tables is much faster than a regular query
  In-Reply-To: <42ce9b74-0671-ecba-3deb-dc8bc8d5e9b3@a-kretschmer.de>
  References: <004b01d436d6$ff96c840$fec458c0$@gmail.com> <42ce9b74-0671-ecba-3deb-dc8bc8d5e9b3@a-kretschmer.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox