Re: why is the LIMIT clause slowing down this SELECT?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: why is the LIMIT clause slowing down this SELECT?
Дата
Msg-id 26895.1186014161@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: why is the LIMIT clause slowing down this SELECT?  (Jeff Davis <pgsql@j-davis.com>)
Список pgsql-general
Jeff Davis <pgsql@j-davis.com> writes:
> On Wed, 2007-08-01 at 15:56 -0500, Mason Hale wrote:
>> SELECT *
>> FROM topic_feed
>> WHERE topic_id = 106947234
>> ORDER BY score DESC
>> LIMIT 25

> In plan 1, the planner thinks that it will find 25 tuples matching that
> topic_id quickly during the backwards index scan on
> topic_feed_score_index. Instead, it looks like it has to go through a
> lot of tuples before it finds the necessary 25.

Yeah.  An index on (topic_id, score) would perhaps be helpful.

            regards, tom lane

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

Предыдущее
От: Reid Thompson
Дата:
Сообщение: Re: Linux distro
Следующее
От: "Scott Marlowe"
Дата:
Сообщение: Re: why is the LIMIT clause slowing down this SELECT?