开发者

Tools to optimize SQL Server data types?

开发者 https://www.devze.com 2023-03-06 18:32 出处:网络
I tried Googling a bit, but I can’t seem to find anything to help me here: Are there any tools or scripts that will “analyse” all the tables in a da开发者_开发百科tabase, and give recommendations f

I tried Googling a bit, but I can’t seem to find anything to help me here: Are there any tools or scripts that will “analyse” all the tables in a da开发者_开发百科tabase, and give recommendations for optimizing the data types based on the values they currently hold?

For example:

  • int column that holds no values above 255 would be better as a tinyint.
  • int or char columns with only “1” and “0” should be bit.
  • guids stored as varchar, should be uniqueidentifier.
  • numeric values stored as varchar.
  • or you could even get really clever and detect IP addresses stored as varchar and suggest changing it to a bigint.


I don't know of any off hand, but I feel it should be design/modeling task, or should be something that should be gone through by a human... any tool wouldn't know why somebody chose int vs tinyint - because maybe the application business logic allows values larger than 255, but the values thus far are all less than 255.

0

精彩评论

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