Secondary Index

Database
Enthusiast

Secondary Index

HI,

can anyone tell me why do we need Secondary Index when we already have PI. Cite some example where we we use both PI and SI

Thanks
1 REPLY
Enthusiast

Re: Secondary Index

Use PI to distribute rows evenly + use a field that is used very often in access.
If you have additional fields in the table that are used very often in the queries create secondary index. or if you want to force any uniqueness or (primary key) create USI.

example: I have customer Id that is used a lot in my queries/joins and I know it will spread my data evenly I will use this field for primary index.
Now I know that there are many queries that use a field called Incident_id/ reservation_num / booking_date.... Then i will create a NUSI on them.