Re: Clustered indexes - When to use them?

Поиск
Список
Период
Сортировка
От MaXX
Тема Re: Clustered indexes - When to use them?
Дата
Msg-id dkb5ao$25p3$1@talisker.lacave.net
обсуждение исходный текст
Ответ на Clustered indexes - When to use them?  (MaXX <bs139412@skynet.be>)
Ответы Re: Clustered indexes - When to use them?  (Scott Marlowe <smarlowe@g2switchworks.com>)
Re: Clustered indexes - When to use them?  ("Jim C. Nasby" <jnasby@pervasive.com>)
Список pgsql-general
Ok thank you,
so I can consider using clustered indexes when I need to 'reorder' random
data to improve the speed of a particular query...

In simple words:
Clustered indexes are like the alphabetical index in a book, where term are
randomly distibuted in the book and regular indexes are more like the table
of content...
Right?

Thanks again,
MaXX

Jim C. Nasby wrote:
> The key expense in doing an index scan is the amount of randomness
> involved in reading the base table. If a table is in the same order as
> the index then reading the base table will be very fast. If the table is
> in a completely random order compared to an index (it's correlation is
> low), then an index scan becomes very expensive because every row you
> read out of the index means seeking to a random page in the table.
>
> So, if you do a lot of querying on the table that would work best with
> an index scan, it's probably worth it to cluster on that index.
>
> Note that I'm talking about index *scans* here, where you're pulling a
> decent number of rows.
>
> There's some other considerations as well, but this is probably the
> biggest one.
>

--
MaXX


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

Предыдущее
От: Alex Turner
Дата:
Сообщение: Re: SQL injection
Следующее
От: Robert Treat
Дата:
Сообщение: Re: looking for multi-language app example using postgresql