Re: slow SELECT ... LIMIT query

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: slow SELECT ... LIMIT query
Дата
Msg-id 23919.995560595@sss.pgh.pa.us
обсуждение исходный текст
Ответ на RE: slow SELECT ... LIMIT query  ("Simon Stanlake" <stanlake@hi.ca>)
Список pgsql-general
"Simon Stanlake" <stanlake@hi.ca> writes:
> can anyone tell me what slowed down the first query?

Well, the first one is going to scan (backwards) in datetimestamp order
until it finds a row with unitid = 2.  The second one is going to use
the unitid index to pick out just the rows with unitid = 2, and then
sort them by timestamp.  Depending on how many rows have unitid = 2
and how new the latest one is, I could see either of these being way
faster than the other.

            regards, tom lane

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

Предыдущее
От: "Simon Stanlake"
Дата:
Сообщение: RE: slow SELECT ... LIMIT query
Следующее
От: Kenneth Been
Дата:
Сообщение: many tables in db