Re: strange query plan with LIMIT

Поиск
Список
Период
Сортировка
От Claudio Freire
Тема Re: strange query plan with LIMIT
Дата
Msg-id BANLkTi=WOo6GnFE3txMuOg7kDSfRmM4aiw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: strange query plan with LIMIT  (tv@fuzzy.cz)
Список pgsql-performance
On Fri, Jun 10, 2011 at 1:22 PM,  <tv@fuzzy.cz> wrote:
>> If I had set the primary key to (diag_id, create_time) would simple
>> queries on
>> diag_id still work well i.e.
>>     select * from tdiag where diag_id = 1234;
>
> Yes. IIRC the performance penalty for using non-leading column of an index
> is negligible. But why don't you try that on your own - just run an
> explain and you'll get an immediate answer if that works.

The effective penalty, which you don't see on your explain, is the
size of the index.

Depends on the data stored there, but the index can grow up to double
size (usually less than that), and the bigger index is slower for all
operations.

But, in general, if you need both a single-column a multi-column
index, just go for a multipurpose multicolumn one.

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

Предыдущее
От: "Pierre C"
Дата:
Сообщение: Re: how much postgres can scale up?
Следующее
От: "Pierre C"
Дата:
Сообщение: Re: how much postgres can scale up?