开发者

Performance of non-clustered indexes on different column types

开发者 https://www.devze.com 2023-03-24 15:10 出处:网络
Is a non-clustered index on an 开发者_运维技巧int column considered more performant than one on a decimal or datetime column?In some ways: yes.

Is a non-clustered index on an 开发者_运维技巧int column considered more performant than one on a decimal or datetime column?


In some ways: yes.

An INT is only 4 bytes - so more INTs will fit on a single 8K page in SQL Server.

DATETIME uses 8 bytes - so fewer DATETIME values are store on a single page, or for the same number of DATETIMEs, 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 DATETIME column - I wouldn't hesitate adding it (again: unless you're dealing with multi-million row tables... then you might need more detailed investigations)

0

精彩评论

暂无评论...
验证码 换一张
取 消