Re: another index question

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: another index question
Дата
Msg-id 920.986160154@sss.pgh.pa.us
обсуждение исходный текст
Ответ на another index question  (Sean Harding <sharding@dogcow.org>)
Ответы Re: another index question  (Sean Harding <sharding@dogcow.org>)
Список pgsql-general
OK, indeed this is a bug --- the planner has a bad interaction for LIMIT
clauses used in "IN" subselects.  Will fix.

You could avoid the bug, and get a better plan at the top level anyway,
by writing

SELECT frm,rcpt,subject FROM mesg_headers WHERE mesgnum = (SELECT mesgnum
FROM mesg_headers ORDER BY mesgnum DESC LIMIT 1);

Since you know the subselect is going to produce exactly one tuple,
there's no need to use IN.

            regards, tom lane

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

Предыдущее
От: "ADBAAMD"
Дата:
Сообщение: Re: Ok, why isn't it using *this* index?
Следующее
От: Joel Burton
Дата:
Сообщение: Can I get the default value for an attribute (field) ?