Microsoft® SQL Server® 2012 Bible

(Ben Green) #1

1101


Chapter 48: Data Compression


48


written to an anchor row at the beginning of each page. This method is repeated for all
subsequent columns in the table.

FIGURE 48-1
The sample data before page compression is enabled.

ggghh

ggghii

gggiii

ggggh

hhhh

ggggii hhhh

ghik

ghik

Page Header

The values are then updated with the prefi x (see Figure 48-2). The fi rst value, ggghh,
begins with four letters of the prefi x, so 4h is written, which saves space on the page. The
compression ratio is much better for values that include more of the prefi x — for example,
ggghii is compressed into just the number 6 because it contains six characters of the pre-
fi x with nothing remaining.

FIGURE 48-2
Prefi x compression identifi es the best prefi x for each column and then stores the prefi x char-
acter count in each row instead of the prefi x characters.

4h

6

ggghii

3iii

4h

0hhhh

6 0hhhh

ggggii

4

ghik

4

Page Header

c48.indd 1101c48.indd 1101 7/31/2012 10:24:09 AM7/31/2012 10:24:09 AM


http://www.it-ebooks.info
Free download pdf