Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
YAQ on Indexes
Message
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01546198
Message ID:
01546204
Views:
31
>>>Hi,
>>>
>>>I am changing the index tags for many SQL Server tables and would like to understand something.
>>>
>>>Here is an example and a question. Say I have a table with a Char field/column (CUSTOMER_ID) and an Integer field/column (SITE_NO). I create a unique index key on thee two column; as the following:
>>>
>>>CREATE UNIQUE INDEX PX_CUST_SITE ON MyTable (customer_id, site_no )
>>>
>>>When a SQL Select will be executed against either one of these fields, customer_id or site_no, will SQL Server use this index? Or I need to create to more separate indexes, one on CUSTOMER_ID and another on SITE_NO?
>>>TIA
>>
>>This index will be used if you query by both Customer_id and site_no, or when you query by customer_id. It will not be used when you query by site_no alone.
>
>Thank you. Since these type of tables are not that big (no more than 5000 records) I will create three index keys for them.

I suggest to run your most common queries before creating any indexes and look at the executiuon plans. It will suggest indexes for you (missing indexes).
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform