Re: LIMIT causes huge slow down - Mailing list pgsql-bugs

From David Johnston
Subject Re: LIMIT causes huge slow down
Date
Msg-id 1394642071713-5795717.post@n5.nabble.com
Whole thread Raw
In response to Re: LIMIT causes huge slow down  (Harry Rossignol <harrywr2@comcast.net>)
Responses Re: LIMIT causes huge slow down
List pgsql-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.

pgsql-bugs by date:

Previous
From: Rainer Tammer
Date:
Subject: Re: Problem with PostgreSQL 9.2.7 and make check on AIX 7.1
Next
From: Joyce.Kai@honeywell.com
Date:
Subject: BUG #9548: jpg error 53 when trying to view jpg stored in blob field