pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrew Schetinin <aschetinin@gmail.com>
Cc: Alex Lai <alai@sesda2.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6426: Complex query runs 10 times longer with "LIMIT 20"
Date: Thu, 02 Feb 2012 11:40:32 -0500
Message-ID: <25499.1328200832@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+fUw71aN8AYCDhBADgvX2y9T+oXGttQy_888jsfk4ujr4Cb7w@mail.gmail.com>
References: <E1Rscoq-0002pv-Ep@wrigleys.postgresql.org>
	<4F2995BB.6050708@sesda2.com>
	<CA+fUw71dQu9enLViyHnMfe7i2ChwJXUKcVWPg6bdsN_NwMvBcg@mail.gmail.com>
	<24544.1328132915@sss.pgh.pa.us>
	<CA+fUw71aN8AYCDhBADgvX2y9T+oXGttQy_888jsfk4ujr4Cb7w@mail.gmail.com>

Andrew Schetinin <aschetinin@gmail.com> writes:
> Previously I always thought that the order of JOINs or conditions in WHERE
> is irrelevant, and query optimizer rearranges the order according to its
> logic. Now it appears that sometimes it may be important.

If you have more than join_collapse_limit JOINs in the query, the order
can matter.

			regards, tom lane



view thread (7+ messages)

Message-ID: <25499.1328200832@sss.pgh.pa.us>
Permalink:  ../25499.1328200832@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/25499.1328200832@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 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-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, aschetinin@gmail.com, alai@sesda2.com
  Subject: Re: BUG #6426: Complex query runs 10 times longer with "LIMIT 20"
  In-Reply-To: <25499.1328200832@sss.pgh.pa.us>
  References: <E1Rscoq-0002pv-Ep@wrigleys.postgresql.org> <4F2995BB.6050708@sesda2.com> <CA+fUw71dQu9enLViyHnMfe7i2ChwJXUKcVWPg6bdsN_NwMvBcg@mail.gmail.com> <24544.1328132915@sss.pgh.pa.us> <CA+fUw71aN8AYCDhBADgvX2y9T+oXGttQy_888jsfk4ujr4Cb7w@mail.gmail.com> <25499.1328200832@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