Optimizing query

Поиск
Список
Период
Сортировка
От Poul Møller Hansen
Тема Optimizing query
Дата
Msg-id 43005482.7020105@pbnet.dk
обсуждение исходный текст
Ответы Re: Optimizing query  (Richard Huxton <dev@archonet.com>)
Re: Optimizing query  (Dennis Bjorklund <db@zigo.dhs.org>)
Список pgsql-general
I have a problem creating a usable index for the following simple query:
SELECT * FROM my.table WHERE node = '10' ORDER BY id DESC LIMIT 1

id is a serial, so the query is to find the latest entry to a given node
and id is the primary key.
The table contains around 1 million records and the query takes around 2
seconds.

I have tried to make an index on node and also on both id & node, but is
doesn't lower the
query time.

What am I doing wrong ?

Thanks,
Poul


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

Предыдущее
От: "Magnus Hagander"
Дата:
Сообщение: Re: Upgrading 8.0.2 to 8.0.3 on Windows XP
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Optimizing query