ericcobb / SQL-Server-Metrics-Pack

A collection of scripts for gathering metrics from SQL Server's underlying DMO's.
MIT License
33 stars 14 forks source link

Index Metrics - SQL 2014 'compression_delay' Error #2

Open ericcobb opened 4 years ago

ericcobb commented 4 years ago

Running the procedure loadIndexMetrics in SQL 2014 SP3 errored out: Invalid column name 'compression_delay'

select compression_delay from sys.indexs Msg 207, Level 16, State 1, Line 313 Invalid column name 'compression_delay'.

almost-everyone commented 4 years ago

There's another tiny bug too, the "vwIndexMetrics_GetScripts" function creation code contains a "FROM [master].[dbo].[vwIndexMetrics_CurrentActiveIndexMetrics]" which is wrong, since that view doesn't exist in the "master" DB and causes the "index-metrics-install.sql" to fail

almost-everyone commented 4 years ago

As for the "compression_delay" a quick workaround is to change the script line to "''DATA_COMPRESSION='' + p.data_compression_desc + '', COMPRESSION_DELAY = '' -- + CAST(ix.compression_delay AS VARCHAR(MAX))" this won't report any value in that column but at least will allow the script to work in older MSSQL versions (tried on 2008r2)

ericcobb commented 4 years ago

There's another tiny bug too, the "vwIndexMetrics_GetScripts" function creation code contains a "FROM [master].[dbo].[vwIndexMetrics_CurrentActiveIndexMetrics]" which is wrong, since that view doesn't exist in the "master" DB and causes the "index-metrics-install.sql" to fail

Thanks for letting me know! I've removed the hard coding to the "master" database.