| От | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера