Monday, November 30, 2026

Compression

1. Row Compression
Örnek
Şöyle yaparız
CREATE TABLE dbo.RowStorageDemo
(
    RecordId INT NOT NULL,
    DepartmentCode CHAR(20) NOT NULL,
    Quantity BIGINT NOT NULL,
    TotalAmount DECIMAL(12, 2) NULL
)
WITH (DATA_COMPRESSION = ROW);

2. Page Compression
Row compression + prefix compression ve dictionary compression olarak düşünülebilir

Prefix compression
Açıklaması şöyle
Prefix compression allows SQL Server to store a shared prefix within a special compression information structure on the page.
Örneğin bir sütünda müşteri bilgisi vep CUSTOMER- şeklinde başlıyorsa işe yarar

Dictionary Compression
Açıklaması şöyle
This technique searches for repeated byte sequences throughout the page, without restricting the search to the beginning of values or a particular column.
Örnek
Şöyle yaparız
CREATE TABLE dbo.CustomerReferenceDemo
(
    RecordId INT NOT NULL
        PRIMARY KEY CLUSTERED,
    CustomerReference VARCHAR(30) NOT NULL,
    RegionCode VARCHAR(20) NOT NULL
)
WITH (DATA_COMPRESSION = PAGE);

No comments:

Post a Comment

Compression

1. Row Compression Örnek Şöyle yaparız CREATE TABLE dbo.RowStorageDemo (     RecordId INT NOT NULL,     DepartmentCode CHAR(20) NOT NULL,   ...