SQL Tips by Namwar Rizvi

June 25, 2007

Vardecimal Storage Format

Filed under: Information,New Features,Performance,SQL Server 2005,tips — namwar @ 10:35 PM

In SQL Server 205, Microsoft has introduced a new storage format for storing decimal values. This format is called vardecimal. This format addresses the issue of inefficient space management for the decimal and numeric data types.
SQL Server uses the format (p,s) to decide about the space to allocate for a numeric or decimal data type where
p=precision or digits before decimal and
s=scale or digits after decimals

In simple words, If you have specified high precision but you are storing small numbers then remaining space will still be allocated and therefore, will be wasted because small value does not require all bytes to represent its value.

Vardecimal is the solution of this. It allocates only as much space as needed by the value to be stored. In simple words we can say Vardecimal does the same for decimal or numeric data types what varchar does for char data types Vardecimal is not the data type instead it is a table option.
For detailed discussion of Vardecimal please refer Vardecimal on MSDN

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: