Subject | RE: Order of key elements |
---|---|
Author | Leyne, Sean |
Post date | 2012-10-15T16:14:48Z |
Rick,
I have always had the impression that it produces the most compact indexes since the engine will use "prefix compression" to group index items together. (I am trying to explain the general approach -- the description is not technically correct)
Sean
> What is the effective difference between these two key elementsPersonally, I always work from generic to most specific.
> orderings?
>
> ALTER TABLE T ADD CONSTRAINT U UNIQUE (PK, HIGH_MAX_DUP)
>
> ALTER TABLE T ADD CONSTRAINT U UNIQUE (HIGH_MAX_DUP, PK)
>
> The first version is how I normally order key elements, from most unique to
> least. Since a primary key index exists, the second would allow
> HIGH_MAX_DUP to be used in queries. But would ordering the key
> elements like this have any impact due to the high number of duplicates (it's
> almost as bad as an even split between Boolean values).
I have always had the impression that it produces the most compact indexes since the engine will use "prefix compression" to group index items together. (I am trying to explain the general approach -- the description is not technically correct)
Sean