Search Postgresql Archives

Re: Clustered indexes - When to use them?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux