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:
01546205
Views:
28
>>>>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).

Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform