Re: Index not used,

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Index not used,
Дата
Msg-id 9519.1049916508@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Index not used,  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-admin
Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> On Wed, 9 Apr 2003, Cris wrote:
>> I've created an index on (id,op,tt) to improve the next query, that is executed very often:
>> "SELECT * FROM BB WHERE id="+ id+" AND op=0 order by tt desc;";
>> (because the only row I need is the one that has the highest tt)

> You might want to use limit 1 then to prevent it from getting all the rest
> of the rows as well.

Also, I think you'll need to say "ORDER BY id, op, tt" to get it to
realize that the index matches the required ordering.

            regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [JDBC] Problems with Large Objects using Postgres 7.2.1
Следующее
От: Robert Treat
Дата:
Сообщение: Re: trouble connecting to Postgresql Database via