How to identify in the system views whether a index is compressed

  • I need to generate index ddl of an existing index. Where in the system views of the sql server 2008 is it specified that an index is compressed ?

    Yours Sincerely

    Kristian Svinding

  • It's in sys.partitions.

    From BoL

    data_compression int

    Indicates the state of compression for each partition:

    0 = NONE

    1 = ROW

    2 = PAGE

    sys.partitions has both object_id and index_id, so you can join it in on those 2, if you have partitioned tables (or indexes), there'll be more than 1 row for an index.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply