Share via

How to identify different compressions

Igor Korot 56 Reputation points
2026-03-06T06:53:26.0633333+00:00

Hi, ALL,

This - https://learn.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys-partitions-transact-sql?view=sql-server-ver17 indicates that there is only 1 record for both XML and regular partition compression.

My question would be - how to identify the XML vs other compressions?

Is there any way both XML and other type can be used?

Thank you.

SQL Server Database Engine
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Erland Sommarskog 133.2K Reputation points MVP Volunteer Moderator
    2026-03-06T21:49:47.2533333+00:00

    Not sure I understand that the question. You can combine "regular" compression with XML compression. For instance:

    CREATE TABLE kompis (id   int          NOT NULL,
                         data varchar(200) NOT NULL,
                         xmldata xml       NULL,
                         CONSTRAINT pk_kompis PRIMARY KEY (id)
      WITH (DATA_COMPRESSION = PAGE, XML_COMPRESSION = ON)
    )
    
    SELECT * FROM sys.partitions WHERE object_id = object_id('kompis')
    

    The output:

    image

    ROW compression is really only an alternative storage format, and not really compression. DATA compression is, but it is still a general form of compression, and it is not likely to apply to a binary data type like the XML data type. XML compression, on the other hand, is particularly aimed for XML.As you can see in the screenshot, there are separate columns in sys.partitions for "normal" compression and XML compression.

    0 comments No comments

  2. Q&A Assist
    2026-03-06T06:53:37.0966667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    sys.partitions.data_compression stores a single compression setting per partition. It does not distinguish between “XML compression” and “regular” row/page/columnstore compression, because XML data is not compressed with a separate XML‑specific compression mode.

    Key points based on SQL Server data compression behavior:

    1. How to see the compression type
      • For any table or index (including those that contain XML columns), the compression type is exposed at the partition level via sys.partitions.data_compression.
      • The values indicate the storage engine compression mode for that partition (for example, NONE, ROW, PAGE, COLUMNSTORE, COLUMNSTORE_ARCHIVE), and apply to the whole partition, not separately to XML vs non‑XML columns.
      • In SSMS, the same information is surfaced on the table’s Storage page under Compression and, for partitioned tables, as:
        • Partitions using page compression
        • Partitions using row compression
        • Partitions not compressed
    2. XML vs “other” compression
      • Data compression (ROW, PAGE, columnstore) is defined at the table/index/partition level and affects how rows/pages are stored in the Database Engine.
      • XML columns are just part of that table/index; there is no separate XML compression mode that would show up as a different value in sys.partitions.
      • Large‑value data types that are stored off‑row (which can include XML) are on special‑purpose pages; the documentation states that “Data compression isn't available for the data that is stored separately.” This means:
        • The partition’s compression setting still has a single value.
        • Off‑row large‑value storage is not additionally compressed by ROW/PAGE compression.
    3. Can XML and “other type” compression be used together?
      • A single partition can only have one data_compression setting.
      • That setting applies to the table/index rows on that partition; it is not possible to have, for the same partition, “XML compressed one way” and “other columns compressed another way.”
      • Different partitions can use different compression types (for example, PAGE on older partitions, ROW or NONE on newer ones), but each partition still exposes only one compression value in sys.partitions.

    Therefore, there is no separate catalog‑level indicator for “XML compression vs other compression,” and both cannot be configured as distinct compression modes on the same partition. The only compression type visible and configurable is the partition’s data_compression value.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.