pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Johnston <polobo@yahoo.com>
To: pgsql-bugs@postgresql.org
Subject: Re: LIMIT causes huge slow down
Date: Wed, 12 Mar 2014 09:34:31 -0700 (PDT)
Message-ID: <1394642071713-5795717.post@n5.nabble.com> (raw)
In-Reply-To: <53206541.8060200@comcast.net>
References: <30655A2C-145C-4DB1-8BF4-F5C3DF6772AB@wmaker.net>
	<53206541.8060200@comcast.net>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Harry Rossignol wrote
> hello
> 
> i am just a lowly application developer, but i always include my 'where' 
> fields in my order by specification.
> I.E. ORDER BY id_webzine,id_flickr,id_picasa,id_photo rather then just 
> id_photo

You really should consider thinking about what you need rather than blindly
adhering to a rule that puts additional burden on the system when it may not
be necessary.

WRT to question posed: probably the easiest workaround is to move the
unlimited query to a WITH clause and then apply the limit separately.

You should indicate what version of PostgreSQL you are using.

Sorry I'm not much help on the how and why of the actual plan choices here. 
The sorting is constant but since the limit and the where clause target
different tables a full evaluation is needed to determine a solution so
picking individual rows, which is what I see happening, doesn't by you
anything.

But, for all I know your using an old version and this undesirable behavior
has already been found and fixed.

David J.





--
View this message in context: http://postgresql.1045698.n5.nabble.com/LIMIT-causes-huge-slow-down-tp5795640p5795717.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (4+ messages)  latest in thread

Message-ID: <1394642071713-5795717.post@n5.nabble.com>
Permalink:  ../1394642071713-5795717.post@n5.nabble.com/
Also on:    postgresql.org/message-id/1394642071713-5795717.post@n5.nabble.com

 · 

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: polobo@yahoo.com
  Subject: Re: LIMIT causes huge slow down
  In-Reply-To: <1394642071713-5795717.post@n5.nabble.com>
  References: <30655A2C-145C-4DB1-8BF4-F5C3DF6772AB@wmaker.net> <53206541.8060200@comcast.net> <1394642071713-5795717.post@n5.nabble.com>

* 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