Usage of Composite Primary Index

Database
Enthusiast

Usage of Composite Primary Index

Hi,

My table Employee has a composite primary index as (last_name, first_name). If I am using only first_name in where clause, will my primary index be used?

Can someone pls explain if primary index is getting used?

Thanks,

Vishal

2 REPLIES
Enthusiast

Re: Usage of Composite Primary Index

In your where clause you need to specify both the columns in order to make use of the PI by the optimizer else it will go for a FTS(full table scan). The reason being the row hash would be calculated to locate the AMP of the row only if both the columns are mentioned.

Enthusiast

Re: Usage of Composite Primary Index

Thanks Krishan :)