Re: bad plan and LIMIT

Поиск
Список
Период
Сортировка
От James Nelson
Тема Re: bad plan and LIMIT
Дата
Msg-id 58728725-13C7-4A47-9D6C-751193773C11@photoshelter.com
обсуждение исходный текст
Ответ на Re: bad plan and LIMIT  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
Список pgsql-performance
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();


В списке pgsql-performance по дате отправления:

Предыдущее
От: James Nelson
Дата:
Сообщение: Re: bad plan and LIMIT
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Transparent table partitioning in future version of PG?