Re: Bad Query Plan with Range Query

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: Bad Query Plan with Range Query
Дата
Msg-id 4DA84476020000250003C8A2@gw.wicourts.gov
обсуждение исходный текст
Ответ на Re: Bad Query Plan with Range Query  (Mark Williams <mark.williams@jivesoftware.com>)
Ответы Re: Bad Query Plan with Range Query
Список pgsql-performance
Mark Williams <mark.williams@jivesoftware.com> wrote:

> If I re-write the query like this:
>
> explain SELECT messageID FROM Message WHERE modificationDate >=
> 1302627793988 ORDER BY modificationDate LIMIT 1;

> I also get a better plan.

Yeah, but it's not necessarily the same value.  Do you want the
minimum messageID where modificationDate >= 1302627793988 or do you
want the messageID of some row (possibly of many) with the minimum
modificationDate where modificationDate >= 1302627793988?

Since you're asking for a logically different value with that query,
it's not surprising it uses a different plan.

-Kevin

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

Предыдущее
От: Mark Williams
Дата:
Сообщение: Re: Bad Query Plan with Range Query
Следующее
От: Mark Williams
Дата:
Сообщение: Re: Bad Query Plan with Range Query