VARCHAR(1)

Kenneth Fisher warns against low VARCHAR sizes:

The first thing you’ll notice is that a single space is stored the same way in both columns. With an empty string, on the other hand, we see a difference. Char columns are fixed length. So even though we inserted an empty string into it we get back a single space.

The next major difference is that varchar columns require an extra two bytes of storage. So a varchar(1) column actually uses three bytes not just the one byte that char(1) does.

This is exactly the type of scenario row-level compression improves.

Related Posts

Data Types In R

Ellen Talbot gives us an overview of the different data types in R: Now here’s something we didn’t cover in the video and is especially helpful if something just WILL NOT work and you’ve spent all morning panic eating biscuits. You can write checks to see if something is numeric, or an integer, with is.numeric() or is.integer(). The […]

Read More

Let’s Not Talk About Timestamp

Randolph West hits us with a misnamed SQL Server data type: It occurred to me that we haven’t covered the TIMESTAMP data type in this series about dates and times. TIMESTAMP is the Windows Millennium Edition of data types. It has nothing to do with date and time. It’s a row version. Microsoft asks that we stop calling it TIMESTAMP and use ROWVERSION instead. Much like DECIMAL is a […]

Read More

Categories

February 2016
MTWTFSS
« Jan Mar »
1234567
891011121314
15161718192021
22232425262728
29