Search process

  • Hi,

    Suppose I have created a [test] table with ID, Lastname, Phonenbr,Address and inserted records accordingly.

    Now I have also created clustered index on phonenbr column and non-clustered index on "Lastname" column in this table.

    If I run the below query, how the sql server will search it. I mean...will it use clustered index for searching addresses or it will use non-clustered index?

    select address from test where lastname='aaaa'

    Thanks

  • Which you have given in the "WHERE" clause.

  • You can answer your question yourself. Click on the Include Actual Execution Plan button and run your query. Inspect the plan to see which of the indexes were used. Try different distributions of data and different criteria in your WHERE clause and compare results. Post back if anything happens that you don't understand.

    John

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply