Re: bad plan and LIMIT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




The 'in' form and 'join' form produce identical plans for both limit and non-limit versions of the query, which I actually think reflects well on the query planner. I also tried a form of the query with the subselect in the from clause to try and force the order the tables were evaluated but the query planner saw through that one too. Basically this query:

SELECT ps_image.id FROM
(SELECT image_id FROM ps_gallery_image WHERE gallery_id='G00007ejKGoWS_cY') as ids INNER JOIN ps_image on ps_image.id = ids.image_id ORDER BY LOWER(FILE_NAME) ASC limit 1;

produces the same plan as the 'in' or the 'join' form when the limit clause is present.

 James



On May 1, 2009, at 4:32 AM, Grzegorz Jaśkiewicz wrote:

use join instead of where in();


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


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux