Tips for SQL Server Performance optimization by Choosing appropriate data type

Best practices for SQL Server data types for performance optimization:
You can improve the performance of Sql Server query (make fast) by reducing the size of the data rows. One of the ways to do this is by using appropriate data types when you create tables. For example:

  • Use bit instead of tinyint, smallint, or int to store Boolean values. The bit data type uses one byte of the storage space per eight columns.
  • Use the appropriate date/time data type based on the precision you need. For example, an order entry system can use smalldatetime (4 bytes of storage space) or datetime2(0) (6 bytes of storage space) rather than datetime (8 bytes of storage space) to store when an order has been placed into the system when one-minute or one-second precision is enough.
  • Use decimal or real rather than float whenever possible.
  • Use money or smallmoney data types rather than float to store money values.
  • Do not use large fixed-length char/binary data types unless the data is always populated and static in size.

Comments

Contact Form

Send