SQL Server 2016 – Temporal Tables and Compressed Indexes

sp-blitzindexsql serversql-server-2016temporal-tables

We use temporal tables in our database, and I have just run Brent Ozar's sp_BlitzIndex on it with @mode=0 (urgent issues only).

It has come up with 33 issues, all of which are "Abnormal Psychology: Compressed indexes", and they are all on the temporal tables e.g.

Schema.TableName.ix_IndexName (1). COMPRESSION: Partition 1 uses PAGE
[CX] [2 KEYS] SysEndTime {datetime2 8}, SysStartTime {datetime2 8}

I am pretty sure we didn't actively choose to turn compression on for these indexes, and I think it is the default behaviour for system generated history tables. But should I be worried? sp_BlitzIndex thinks I should be…

What are the recommended best practices? Thanks in advance.

Best Answer

This is default behaviour for temporal tables, the history tables are PAGE compressed by default. This is done out of space & performance considerations, compression will reduce the amount of data that has to be processed, both on disk & memory. This will have a trade-off in extra CPU cycles as SQL Server has to decompress the data. So unless you are under CPU pressure, compression is usually a good thing as your disk IO & memory usage improve.

More information on temporal tables: Temporal Table Considerations and Limitations

For what sp_BlitzIndex page says about it:

Abnormal psychology findings aren’t necessarily problems– just look at this as a big FYI. Some implementations of indexes may mean that the database can only be restored in a certain edition of SQL Server, or they may change performance of some operations. Which apply to you? Check out details on your finding below.

So as stated above, this does not mean it is a problem. For the reasons described above.