From: | MaXX <bs139412(at)skynet(dot)be> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Clustered indexes - When to use them? |
Date: | 2005-11-02 19:50:45 |
Message-ID: | dkb5ao$25p3$1@talisker.lacave.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Treat | 2005-11-02 20:07:02 | Re: looking for multi-language app example using postgresql |
Previous Message | Alex Turner | 2005-11-02 19:26:21 | Re: SQL injection |