[PERFORM] bad plan and LIMIT

2009-05-01 Thread James Nelson
e) but not sure why it is inaccurate compared to the actual times. Thanks in advance for taking a look at this, let me know if there is additional information I should provide. Some information about the tables and the explains follow below. James Nelson [ja...@db2 ~] psql --version psql (PostgreSQ

Re: [PERFORM] bad plan and LIMIT

2009-05-01 Thread James Nelson
EXISTS (SELECT null FROM ps_gallery_image WHERE gallery_id ='G7ejKGoWS_cY' and image_id = ps_image.id) ORDER BY LOWER(FILE_NAME) ASC On 30/04/2009, at 3:51 AM, James Nelson wrote: Hi, I'm hoping you guys can help with improving this query I'm having a problem with.

Re: [PERFORM] bad plan and LIMIT

2009-05-01 Thread James Nelson
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

Re: [PERFORM] bad plan and LIMIT

2009-05-01 Thread James Nelson
t across two tables foil any attempt? In any case, I'd like to thank everyone for their input. The query above will be a big help. be well, James On May 1, 2009, at 10:57 AM, Tom Lane wrote: James Nelson writes: Hi, I'm hoping you guys can help with improving this query I&#