Is a non-clustered index on an int column considered more performant than one on a decimal or datetime column?
Is a non-clustered index on an int column considered more performant than one on
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In some ways: yes.
An
INTis only 4 bytes – so moreINTs will fit on a single 8K page in SQL Server.DATETIMEuses 8 bytes – so fewerDATETIMEvalues are store on a single page, or for the same number ofDATETIMEs, you need more pages, hence you get more disk I/O and thus less performance.How much of a difference there is, is up to more detailed measurement, however – for anything under millions of rows, the difference most likely will be negligable. If your queries do benefit from an index on that
DATETIMEcolumn – I wouldn’t hesitate adding it (again: unless you’re dealing with multi-million row tables… then you might need more detailed investigations)