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: Wed, 01 Feb 2012 16:48:35 -0500
Message-ID: <24544.1328132915@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+fUw71dQu9enLViyHnMfe7i2ChwJXUKcVWPg6bdsN_NwMvBcg@mail.gmail.com>
References: <E1Rscoq-0002pv-Ep@wrigleys.postgresql.org>
	<4F2995BB.6050708@sesda2.com>
	<CA+fUw71dQu9enLViyHnMfe7i2ChwJXUKcVWPg6bdsN_NwMvBcg@mail.gmail.com>

Andrew Schetinin <aschetinin@gmail.com> writes:
> In my specific case, what I've seen from the query execution plans, is that
> without LIMIT the query uses Hash Joins, but once I add LIMIT, it starts
> using Nested Loop Joins almost everywhere.

Usually, that's an appropriate change for a small LIMIT.  It's certainly
not a priori evidence of a planner bug.

If you want useful comments about this, please review
http://wiki.postgresql.org/wiki/Slow_Query_Questions
about how to provide an adequate description of your problem.

			regards, tom lane



view thread (7+ messages)  latest in thread

Message-ID: <24544.1328132915@sss.pgh.pa.us>
Permalink:  ../24544.1328132915@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/24544.1328132915@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: <24544.1328132915@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>

* 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