What data should I index in a SQL database?

Tags:
SQL Server 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?

Answer Wiki

Thanks. We'll let you know when a new response is added.

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.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    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.
    69,510 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following