Three-Byte Integers in SQL Server: Fact or Fiction?

I've been told on two occasions that the absence of the MEDIUMINT datatype is a serious shortcoming of SQL Server. If you're not familiar with MEDIUMINT, it's an integer type available in MySQL that consumes 3 Bytes and is capable of storing values ranging from -8,388,608 to 8,388,607 (signed) or from 0 to 15,777,215 (unsigned). While SQL Server has many datatypes, it has nothing that exactly matches MEDIUMINT. In SQL Server, if you wanted to store a value between 32,768 and 2,147,483,647 you would need to use the INT datatype, each of which takes up 4 Bytes. The next smallest…
Read More

Why I Hate Row Compression

This post is part of T-SQL Tuesday #52, which is being hosted this month by Michael J. Swart (@MJSwart). Michael is asking us to argue against a popular opinion, and I'm more than happy to do so, as this is a belief that I've kept to myself for quite a while. SQL Server's row compression feature can be an amazing tool. Not only is it lightweight on CPU usage, especially when compared to page compression, but it can save a significant amount of disk space as well. Your data also remains compressed while in the buffer pool, meaning more rows can be stored…
Read More