![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, Let's say I have a large table which includes an row with values generated from a sequence, i.e. ever-increasing values (BIGINTs); the row is indexed with a clustering index. New rows are regularly added to the table, and sometimes, a few rows are updated. The users are normally only interested in the latest 20% of the rows. Am I right in thinking that the clustering index shoud be created with the DESC attribute, because it will increase the chance of cache (buffer pool) hits when using the index? -- Troels |
#3
| |||
| |||
|
|
I don't think there is a difference with regards to caching. Why do you expect to have more cache hits with this cluster index? |
|
An ascending index makes more sense to me, actually. With a descending clustering index, DB2 will constantly try to insert records at the beginning of the table. Very quickly, there will be no space left there and he will have to revert to appending to the end of the table. |
|
In your case, if you never delete, you could even try to use APPEND mode, you'll be surprised how good your cluster factor on this specific column will remain (don't update too much and use PCTFREE) :-) |
#4
| |||
| |||
|
|
Hello, Frederik Engelen wrote: I don't think there is a difference with regards to caching. Why do you expect to have more cache hits with this cluster index? I was temporarily confused. An ascending index makes more sense to me, actually. With a descending clustering index, DB2 will constantly try to insert records at the beginning of the table. Very quickly, there will be no space left there and he will have to revert to appending to the end of the table. Good point. But what's the point with DESC indexes, then? In the PostgreSQL documentation, it states that DESC indexes are un-interesting for single- column indexes, but that they may make sense for multi-column indexes. The DB2 documentation doesn't give any advice (or I haven't looked closely enought). In your case, if you never delete, you could even try to use APPEND mode, you'll be surprised how good your cluster factor on this specific column will remain (don't update too much and use PCTFREE) :-) Yes, I thought that it would make a lot of sense, but I also thought that APPEND-only tables could only be used if table changes are strictly always inserts(?) -- Troels |
![]() |
| Thread Tools | |
| Display Modes | |
| |