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.