What data should I index in a SQL database?
0
Q:
What data should I index in a SQL database?
When advice is given to only index on selective data in a SQL database, would you therefore index on a four digit integer (ID number) or a patient's name, for example? Would this make sense logistically?
ASKED: Dec 2 2008  4:31 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
130 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
If you are using sql server 2005, you don't need to include in the index all the columns because you can use the operator INCLUDE in the CREATE INDEX statement.

If you are using a previous version of sql server instead, it can have sense if you are able to include in your index all the columns that you have to retrieve in the query you want to improve; in order to avoid reading both the index data and the row data.
Last Answered: Dec 2 2008  6:58 PM GMT by Paulus   130 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Carlosdl   29820 pts.  |   Dec 2 2008  8:12PM GMT

If you choose to index on some specific fields, what fields should you include in your index will depend on the search criteria you will use when querying the table. If you will search by ID number, then you should index on that field.

 
0