Re: Indexes

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Indexes
Дата
Msg-id 15516.1092971792@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Indexes  (Primoz <primoz@slo-tech.com>)
Список pgsql-general
Primoz <primoz@slo-tech.com> writes:
> is there any way to speedup queryes like

> select ... from [table a] where [int field b] = [number] order by [datetime
> field c] desc limit [number];

For reasonably-small values of the LIMIT, what you want is
    (a) a two-column index on (b,c)
    (b) change the ORDER BY to
        ORDER BY b DESC, c DESC

See the pgsql-performance archives for more discussion.

            regards, tom lane

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

Предыдущее
От: Primoz
Дата:
Сообщение: Indexes
Следующее
От: Hunter Hillegas
Дата:
Сообщение: Re: Postgres and JBOSS