improve.dk
Just another mindless drone looking for the perfect stack
posts - 220, comments - 475

SQL Server: Internals


The Anatomy of Row & Page Compressed Integers

Written on Monday, January 30, 2012 by Mark S. Rasmussen in SQL Server: Internals, SQL Server: OrcaMDF, SQL Server: Compression

How are integers stored on disk when using row or page compression?

No comments | Write first comment
 

The Anatomy of Vardecimals

Written on Tuesday, December 13, 2011 by Mark S. Rasmussen in SQL Server: Internals, SQL Server: OrcaMDF, SQL Server: Vardecimal

How are vardecimals stored on disk? Here's a deep dive explanation.

No comments | Write first comment
 

Determining If Vardecimal Is Enabled For a Table Without Using OBJECTPROPERTY

Written on Monday, December 12, 2011 by Mark S. Rasmussen in SQL Server: Internals, SQL Server: Vardecimal

How do we determine if vardecimal is enabled for a table, without using the OBJECTPROPERTY function?

No comments | Write first comment
 

Presenting a free preview of my SQL Server Storage Engine and MDF File Internals training day

Written on Thursday, August 04, 2011 by Mark S. Rasmussen in SQL Server: Internals, SQL Server: SQLBits, Presenting

Join me for a free preview of my SQL Server Storage Engine and MDF File Internals training day.

No comments | Write first comment
 

What is the size of the LOB pointer for (MAX) types like varchar, varbinary, etc?

Written on Monday, July 18, 2011 by Mark S. Rasmussen in SQL Server: Internals, SQL Server: SLOBs & LOBs

Learn about the different pointer types & sizes for (MAX) LOB data types - BLOB Inline Data, BLOB Inline Root and Textpointer.

No comments | Write first comment
 

The garbage null bitmap and why you can’t rely on it solely

Written on Saturday, July 16, 2011 by Mark S. Rasmussen in SQL Server: Internals, SQL Server: Null Bitmap

Don't trust bits in the null bitmap as they may contain garbage. Here's an example of how it may occur and why it doesn't matter.

No comments | Write first comment
 

The 8 byte record that was 9 bytes while making no sense

Written on Saturday, July 16, 2011 by Mark S. Rasmussen in SQL Server: Internals

Sometimes record structures aren't straightforward. Here's an example of a record that doesn't make any immediate sense when parsing it.

7 comments | Read comments
 

The null bitmap is *not* always present in data records

Written on Friday, July 15, 2011 by Mark S. Rasmussen in SQL Server: Internals, SQL Server: Null Bitmap, SQL Server: Sparse Columns

Contrary to popular belief, the null bitmap is not always present in data records. Here's an example of a data record that doesn't contain a null bitmap due to using sparse columns.

5 comments | Read comments
 

Sparse column storage – the sparse vector

Written on Friday, July 15, 2011 by Mark S. Rasmussen in SQL Server: Internals, SQL Server: Sparse Columns

Sparse columns are stored entirely different from normal fixed length and variable length columns. This post demonstrates & parses the sparse vector structure which stores the sparse columns.

No comments | Write first comment
 

Identifying complex columns in records

How do we distinguish a normal variable length column value from one containing a complex value like a row-overflow pointer, back pointer or a sparse vector?

No comments | Write first comment
 

Creating a type aware parser for the sys.system_internals_partition_columns.ti field

Written on Wednesday, July 13, 2011 by Mark S. Rasmussen in SQL Server: Internals

Learn how to parse the base table sysrscols ti field values.

No comments | Write first comment
 

Exploring the sys.system_internals_partition_columns.ti field

Written on Wednesday, July 13, 2011 by Mark S. Rasmussen in SQL Server: Internals

Learn how the sys.system_internals_partition_columns view retrieves its values from the sysrscols base table column, ti.

No comments | Write first comment
 

Determining the uniquifier column ordinal for clustered and nonclustered indexes

Written on Wednesday, July 06, 2011 by Mark S. Rasmussen in SQL Server: Internals, SQL Server: Uniquifier

Once you know what the uniquifier is, you may thirst for more details. This post outlines how to determine where the uniquifier is stored internally in records.

No comments | Write first comment
 

Getting bit by datetime rounding or why 23:59:59.999 > '23:59:59.999'

Written on Thursday, June 16, 2011 by Mark S. Rasmussen in SQL Server: Internals, SQL Server: Data Types

Why won't SQL Server store the datetime values you insert? Learn & understand why SQL Server will round any values of .998 or .999 to either .997 or .000 precision.

No comments | Write first comment
 

Anatomy of a forwarded record – the back pointer

Written on Thursday, June 09, 2011 by Mark S. Rasmussen in SQL Server: Internals, SQL Server: Forwarded Records

Learn how a forwarded record in a heap stores a back pointer that refers to the original record from where it's forwarded.

No comments | Write first comment
 

Anatomy of a forwarded record – the forwarding stub

Written on Tuesday, June 07, 2011 by Mark S. Rasmussen in SQL Server: Internals, SQL Server: Forwarded Records

Learn the internals of how a record gets forwarded in a heap. Specifically we'll look at the forwarding stub that is left behind, pointing at the forwarded record.

No comments | Write first comment
 

Saving space by storing decimal values in integer data types

Written on Tuesday, May 31, 2011 by Mark S. Rasmussen in SQL Server: Internals, SQL Server: Tricks, SQL Server: Data Types

Learn how to effectively store decimal values in SQL Server while taking up as little space as possible.

4 comments | Read comments
 

Reverse engineering SQL Server page headers

Written on Thursday, May 19, 2011 by Mark S. Rasmussen in Development: .NET, SQL Server: Internals

Learn the internal format of a SQL Server page header as presented by DBCC PAGE. Using reverse engineering I'll show how to parse the header data.

No comments | Write first comment
 

Bridging the gap between smallint and int

Written on Thursday, May 19, 2011 by Mark S. Rasmussen in SQL Server: Internals, SQL Server: Data Types

Learn the difference between smallint and int, as well as how to mimic the MySQL mediumint data type in SQL Server.

No comments | Write first comment
 

Reading bits in OrcaMDF

Written on Thursday, May 12, 2011 by Mark S. Rasmussen in SQL Server: Internals, SQL Server: Data Types, SQL Server: OrcaMDF

Learn how bits are stored internally in SQL Server. In this post I'll also show how OrcaMDF parses bits from records.

No comments | Write first comment
 

Parsing dates in OrcaMDF

Written on Tuesday, May 10, 2011 by Mark S. Rasmussen in SQL Server: Internals, SQL Server: Data Types, SQL Server: OrcaMDF

Learn how SQL Server data types like date, datetime and smalldatetime are stored internally. In this post I'll also show how OrcaMDF parses these types.

No comments | Write first comment
 

Introducing OrcaMDF

Written on Tuesday, May 03, 2011 by Mark S. Rasmussen in SQL Server: Internals, SQL Server: OrcaMDF

Learn about OrcaMDF, the open source library for parsing SQL Server MDF files, by Mark S. Rasmussen.

2 comments | Read comments
 

Converting page pointers into a human readable format

Written on Thursday, April 28, 2011 by Mark S. Rasmussen in SQL Server: Internals, SQL Server: Tricks

Learn how to convert the first_page, root_page, first_iam_page and general page pointers from hexadecimal to a human readable format.

2 comments | Read comments
 

Deciphering a SQL Server data page

Written on Thursday, March 26, 2009 by Mark S. Rasmussen in SQL Server: Internals

Want to learn to dechiper a SQL Server data page? In this post I'll go through the contents of a data page using the SQL Server DBCC PAGE command.

4 comments | Read comments