pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Eduard CatalĂ  <eduard.catala@gmail.com>
Cc: pgsql-performance@lists.postgresql.org
Subject: Re: Table order at FROM clause affects performance?
Date: Thu, 12 Apr 2018 11:30:28 -0400
Message-ID: <12796.1523547028@sss.pgh.pa.us> (raw)
In-Reply-To: <CAL54xNYE38bzJGKWbhAe3g_36yc8HNLhxwPJRqs85qdKGAxEmQ@mail.gmail.com>
References: <CAL54xNYE38bzJGKWbhAe3g_36yc8HNLhxwPJRqs85qdKGAxEmQ@mail.gmail.com>

=?UTF-8?Q?Eduard_Catal=C3=A0?= <eduard.catala@gmail.com> writes:
> Given this statement:

> SELECT *several_fields*  FROM A, B, C WHERE  *conditions*
> A, B are tables with several LEFT JOINS but they act as one subquery.

You really can't expect useful help if you are going to pose questions
that abstract.  You have removed details that count, and made assumptions
that don't necessarily hold (e.g., what does "act as one subquery" mean?)

Probably the most likely bet, on this limited information, is that there
are enough base tables hidden inside your query that you're running into
join_collapse_limit and/or from_collapse_limit, resulting in the planner
failing to investigate the best available plan in one case.  Raising those
limits would help, if so.  But it could easily be something else.

There's some suggestions here about how to ask useful questions:

https://wiki.postgresql.org/wiki/Slow_Query_Questions

			regards, tom lane




view thread (3+ messages)  latest in thread

Message-ID: <12796.1523547028@sss.pgh.pa.us>
Permalink:  ../12796.1523547028@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/12796.1523547028@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, eduard.catala@gmail.com, pgsql-performance@lists.postgresql.org
  Subject: Re: Table order at FROM clause affects performance?
  In-Reply-To: <12796.1523547028@sss.pgh.pa.us>

* 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