Re: Does it make sense to have 2 unique keys in one table?
Posted in 1995
Topics: Performance & Tuning
Sometimes yes, sometimes no. Usually you can make a query take advantage of
the index even if you don't really want to use the leading fields.
e.g. you would like a query based on columns 3 and 4. To allow the use of the
4 column index you could add cols 1 and 2 into the query even though you don't
really need them.
Select * from xyz
where column1 > 0
and column2 > ''
and column3 = 'abc'
and column4 > 10;
You would need to try this and then use explain plan to see if the optimizer
is indeed making use of the index.
HTH
Jim Gregory
>>==========Empty, 10/3/95==========
>>
>>if the columns are partially duplicated, like
>>
>>unique key1 unique key2
>>column1 column3
>>column2 column4
>>column3
>>column4
>>
>>does this make sense?
>>
>>-- Bill
>>
Views and opinions expressed are mine and do not reflect
my empoyer's or client's.