Indexes

  • I am fairly new to SQL Server arena and want to understand how indexes work here. I know how to create an index. But I want to know how to use them. Does SQL Server engine decide which index to use based upon your statement. What if I want to force it to use a particular index?

  • Generally you should leave it to SQL server to decide which indexes will be used. If you'd like to force the usage of a specific index look in BOL for index hints. But as I said before you shouldn't really do this in a production system. I've seen serious perfomance issues in applications which used hardcoded index hints.

    M

    [font="Verdana"]Markus Bohse[/font]

  • How would I know which index is being used for a statement. Even if I want to SQL Server to decide which one to use, is there any way for me to know that?

  • Paste your statement(s) into SQL Query analyzer window and click Ctrl-L

     - it will show you the estimated execution plan in the bottom window. Move mouse over every picture - and you will see a pop-up window (for "index seek" pictures you will see the index name used).

    Alex

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

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