{"id":433,"date":"2019-10-18T05:08:00","date_gmt":"2019-10-17T16:08:00","guid":{"rendered":"https:\/\/blog.wiseowls.co.nz\/?p=433"},"modified":"2026-03-08T00:44:46","modified_gmt":"2026-03-07T11:44:46","slug":"monitoring-sql-server-index-maintenance","status":"publish","type":"post","link":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/10\/18\/monitoring-sql-server-index-maintenance\/","title":{"rendered":"Monitoring SQL Server: index maintenance"},"content":{"rendered":"\n<p>Now that we&#8217;ve got <a href=\"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/10\/04\/monitoring-sql-server-fiddling-with-sp_whoisactive-output\/\">basic SQL queries going<\/a>, we want to collect some actionable intel. A good measure of any SQL database performance is how well indexes are utilised.<\/p>\n\n\n\n<p>This isn&#8217;t new<\/p>\n\n\n\n<p>All queries we&#8217;re about to share are hardly a revelation. What we however want to achieve is to have an idea of how that information changes over time<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Index utilisation<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">input {\n\t############################################################# Index Maintenance ############################################################################\n\tjdbc {\n\t\tid => \"master_index_maintenance\"\n\t\tjdbc_driver_library => \"path\\to\\jdbc\\lib\\mssql-jdbc-7.2.1.jre8.jar\"\n\t\tjdbc_driver_class => \"com.microsoft.sqlserver.jdbc.SQLServerDriver\"\n\t\tjdbc_connection_string => \"jdbc:sqlserver:\/\/&lt;your connection string>\"\n\t\tjdbc_user => nil\n\t\tschedule => \"*\/15 * * * *\"\n\t\tstatement => \"\tDECLARE @db_id INT\n\t\t\t\t\t\tDECLARE @db_name NVARCHAR(120)\n\t\t\t\t\t\tDECLARE @index_data TABLE(\n\t\t\t\t\t\t\t\t\t\t\t\t[database_name] NVARCHAR(128) NOT NULL,\n\t\t\t\t\t\t\t\t\t\t\t\ttable_name sysname NOT NULL, \n\t\t\t\t\t\t\t\t\t\t\t\tindex_name sysname NULL, \n\t\t\t\t\t\t\t\t\t\t\t\tindex_type TINYINT NOT NULL, \n\t\t\t\t\t\t\t\t\t\t\t\tuser_seeks bigint NOT NULL, \n\t\t\t\t\t\t\t\t\t\t\t\tuser_scans bigint NOT NULL, \n\t\t\t\t\t\t\t\t\t\t\t\tuser_lookups bigint NOT NULL, \n\t\t\t\t\t\t\t\t\t\t\t\tuser_updates bigint NOT NULL\n\t\t\t\t\t\t\t\t\t\t\t   );\n\n\t\t\t\t\t\tSET NOCOUNT ON\n\t\t\t\t\t\tDECLARE @dbs table ([db_name] sysname)\n\t\t\t\t\t\tDECLARE @db_query_sql nvarchar(4000)\n\t\t\t\t\t\tSET @db_query_sql='select ''?'' as [db_name] from [?].sys.tables t WHERE t.name = ''Users''';\n\n\t\t\t\t\t\tINSERT INTO @dbs ([db_name]) EXEC sp_msforeachdb @db_query_sql\n\t\t\t\t\t\tSET NOCOUNT OFF\n\n\t\t\t\t\t\tDECLARE db_id_cursor CURSOR FOR SELECT DB_ID([db_name]), [db_name] FROM @dbs FOR READ ONLY \n\t\t\t\t\t\tOPEN db_id_cursor  \n\t\t\t\t\t\tFETCH NEXT FROM db_id_cursor INTO @db_id, @db_name;  \n\t\t\t\t\t\tWHILE @@FETCH_STATUS = 0  \n\t\t\t\t\t\tBEGIN\n\t\t\t\t\t\t\tDECLARE @sql NVARCHAR(MAX) = CAST(N'USE [' + @db_name + '];\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tSELECT ''' + @db_name + ''', t.[name], ix.[name], ix.[type], us.user_seeks, us.user_scans, us.user_lookups, us.user_updates\n\t\t\t\t\t\t\tFROM sys.dm_db_index_usage_stats us\n\t\t\t\t\t\t\tINNER JOIN sys.indexes ix ON us.object_id = ix.object_id and ix.index_id = us.index_id\n\t\t\t\t\t\t\tINNER JOIN sys.tables t ON ix.object_id = t.object_id\t\n\t\t\t\t\t\t\tWHERE us.database_id = ' + CAST(@db_id AS NVARCHAR(10)) AS NVARCHAR(MAX));\n\n\t\t\t\t\t\t\tINSERT INTO @index_data EXEC sys.sp_executesql @sql;\n\t\t\t\t\t\t\tFETCH NEXT FROM db_id_cursor INTO @db_id, @db_name;  \n\t\t\t\t\t\tEND\n\t\t\t\t\t\tCLOSE db_id_cursor\n\t\t\t\t\t\tDEALLOCATE db_id_cursor\n\t\t\t\t\t\tSELECT * FROM @index_data\"\n\t\tadd_field => {\n\t\t\t\t\t\t\"sql_instance\" => \"SQL2\"\n\t\t\t\t\t}\n\t}\n\t################################################################################################################################################################\t\n}\noutput {\n\telasticsearch {\n\t\thosts => \"elasticsearch:9200\"\n\t\tindex => \"sql-index-stats-%{+YYYY.MM}\"            \n\t}\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Missing indexes<\/h2>\n\n\n\n<p>This one is a bit more interesing in a sense that we will get actual index hints. It is not a silver bullet though &#8211; this still needs to be analysed by humans for best results.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">input {\n\t############################################################# Master sp_WhoIsActive ############################################################################\n\tjdbc {\n\t\tid => \"master_missing_indexes\"\n\t\tjdbc_driver_library => \"path\\to\\jdbc\\lib\\mssql-jdbc-7.2.1.jre8.jar\"\n\t\tjdbc_driver_class => \"com.microsoft.sqlserver.jdbc.SQLServerDriver\"\n\t\tjdbc_connection_string => \"jdbc:sqlserver:\/\/&lt;your connection string>\"\n\t\tjdbc_user => nil\n\t\tschedule => \"1 *\/2 * * *\"\n\t\tstatement => \"\tDECLARE @db_id INT\n\t\t\t\t\t\tDECLARE @db_name NVARCHAR(120)\n\t\t\t\t\t\tDECLARE @index_data TABLE(\n\t\t\t\t\t\t\t\t\t\t\t\t[database_name] NVARCHAR(128) NOT NULL,\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\ttable_name sysname NOT NULL, \n\t\t\t\t\t\t\t\t\t\t\t\tunique_compiles bigint NOT NULL,\n\t\t\t\t\t\t\t\t\t\t\t\tuser_seeks bigint NOT NULL, \n\t\t\t\t\t\t\t\t\t\t\t\tuser_scans bigint NOT NULL, \n\t\t\t\t\t\t\t\t\t\t\t\tavg_total_user_cost float NULL, \n\t\t\t\t\t\t\t\t\t\t\t\tavg_user_impact float NULL, \n\t\t\t\t\t\t\t\t\t\t\t\toverall_impact float NOT NULL,\n\t\t\t\t\t\t\t\t\t\t\t\tsql_code NVARCHAR(MAX) NOT NULL\n\t\t\t\t\t\t\t\t\t\t\t   );\n\n\t\t\t\t\t\tSET NOCOUNT ON\n\t\t\t\t\t\tDECLARE @dbs table ([db_name] sysname)\n\t\t\t\t\t\tDECLARE @db_query_sql nvarchar(4000)\n\t\t\t\t\t\tSET @db_query_sql='select ''?'' as [db_name] from [?].sys.tables t WHERE t.name = ''Users''';\n\n\t\t\t\t\t\tINSERT INTO @dbs ([db_name]) EXEC sp_msforeachdb @db_query_sql\n\t\t\t\t\t\tSET NOCOUNT OFF\n\n\t\t\t\t\t\tDECLARE db_id_cursor CURSOR FOR SELECT DB_ID([db_name]), [db_name] FROM @dbs FOR READ ONLY \n\t\t\t\t\t\tOPEN db_id_cursor  \n\t\t\t\t\t\tFETCH NEXT FROM db_id_cursor INTO @db_id, @db_name;  \n\t\t\t\t\t\tWHILE @@FETCH_STATUS = 0  \n\t\t\t\t\t\tBEGIN\n\t\t\t\t\t\t\tDECLARE @sql NVARCHAR(MAX) = CAST(N'USE [' + @db_name + '];\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tWITH index_definitions (table_name, unique_compiles, user_seeks, users_scans, avg_total_user_cost, \n\t\t\t\t\t\t\tavg_user_impact, [overall_impact], column_names, included_columns) \n\t\t\t\t\t\t\tAS (\n\t\t\t\t\t\t\t\tSELECT TOP(600) object_name(c.object_id) AS table_name, \n\t\t\t\t\t\t\t\ta.unique_compiles, a.user_seeks, a.user_scans, a.avg_total_user_cost, a.avg_user_impact, \n\t\t\t\t\t\t\t\ta.avg_total_user_cost * a.avg_user_impact * (a.user_seeks + a.user_scans) AS [overall_impact],\n\t\t\t\t\t\t\t\tcase when c.equality_columns is not null and c.inequality_columns is not null then c.equality_columns + '', '' + c.inequality_columns\n\t\t\t\t\t\t\t\twhen c.equality_columns is not null and c.inequality_columns is null then c.equality_columns\n\t\t\t\t\t\t\t\twhen c.inequality_columns is not null then c.inequality_columns\n\t\t\t\t\t\t\t\tEND AS column_names,\n\t\t\t\t\t\t\t\tc.included_columns\n\t\t\t\t\t\t\t\tFROM sys.dm_db_missing_index_group_stats a\n\t\t\t\t\t\t\t\tinner join sys.dm_db_missing_index_groups b ON a.group_handle = b.index_group_handle\n\t\t\t\t\t\t\t\tinner join sys.dm_db_missing_index_details c on c.index_handle = b.index_handle\n\t\t\t\t\t\t\t\twhere database_id = ' + CAST(@db_id AS NVARCHAR(10)) + '\n\t\t\t\t\t\t\t\tand equality_columns is not null\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tSELECT '''+ @db_name +''' AS [database], table_name, unique_compiles, user_seeks, users_scans, avg_total_user_cost, avg_user_impact, overall_impact, ''CREATE NONCLUSTERED INDEX IX_'' + REPLACE(REPLACE(REPLACE(index_definitions.column_names, ''], ['', ''_''), ''['', ''''), '']'', '''') \n\t\t\t\t\t\t\t\t\t+ '' on '' + index_definitions.table_name + '' ('' + index_definitions.column_names + '') INCLUDE ('' + index_definitions.included_columns + '')''  AS [sql_code]\n\t\t\t\t\t\t\tFROM index_definitions WHERE index_definitions.included_columns IS NOT NULL\n\t\t\t\t\t\t\tUNION \n\t\t\t\t\t\t\tSELECT '''+ @db_name +''' AS [database], table_name, unique_compiles, user_seeks, users_scans, avg_total_user_cost, avg_user_impact, overall_impact, ''CREATE NONCLUSTERED INDEX IX_'' + REPLACE(REPLACE(REPLACE(index_definitions.column_names, ''], ['', ''_''), ''['', ''''), '']'', '''') \n\t\t\t\t\t\t\t\t\t+ '' on '' + index_definitions.table_name + '' ('' + index_definitions.column_names + '')'' AS [sql_code]\n\t\t\t\t\t\t\tFROM index_definitions WHERE index_definitions.included_columns IS NULL' AS NVARCHAR(MAX));\n\n\t\t\t\t\t\t\tINSERT INTO @index_data EXEC sys.sp_executesql @sql;\n\t\t\t\t\t\t\tFETCH NEXT FROM db_id_cursor INTO @db_id, @db_name;  \n\t\t\t\t\t\tEND\n\t\t\t\t\t\tCLOSE db_id_cursor\n\t\t\t\t\t\tDEALLOCATE db_id_cursor\n\t\t\t\t\t\tSELECT * FROM @index_data;\"\n\t\tadd_field => {\n\t\t\t\t\t\t\"sql_instance\" => \"SQL2\"\n\t\t\t\t\t}\n\t}\n\t################################################################################################################################################################\t\n}\noutput {\n\telasticsearch {\n\t\thosts => \"elasticsearch:9200\"\n\t\tindex => \"sql-missing-indexes-%{+YYYY.MM}\"            \n\t}\n}<\/code><\/pre>\n\n\n\n<p>With data collection out of the way it&#8217;s time to move on to plotting graphs. Grafana is quite easy to pick up so instead of repeating official documentation we&#8217;d share a few dashboards we have in place<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">{\n  \"annotations\": {\n    \"list\": [\n      {\n        \"builtIn\": 1,\n        \"datasource\": \"-- Grafana --\",\n        \"enable\": true,\n        \"hide\": true,\n        \"iconColor\": \"rgba(0, 211, 255, 1)\",\n        \"name\": \"Annotations &amp; Alerts\",\n        \"type\": \"dashboard\"\n      }\n    ]\n  },\n  \"editable\": true,\n  \"gnetId\": null,\n  \"graphTooltip\": 0,\n  \"id\": 33,\n  \"iteration\": 1584410507264,\n  \"links\": [],\n  \"panels\": [\n    {\n      \"collapsed\": false,\n      \"datasource\": null,\n      \"gridPos\": {\n        \"h\": 1,\n        \"w\": 24,\n        \"x\": 0,\n        \"y\": 0\n      },\n      \"id\": 74,\n      \"panels\": [],\n      \"title\": \"Index usage\",\n      \"type\": \"row\"\n    },\n    {\n      \"columns\": [],\n      \"datasource\": \"Elasticsearch [index-stats]\",\n      \"fontSize\": \"100%\",\n      \"gridPos\": {\n        \"h\": 5,\n        \"w\": 24,\n        \"x\": 0,\n        \"y\": 1\n      },\n      \"id\": 72,\n      \"interval\": \"1h\",\n      \"links\": [],\n      \"maxPerRow\": null,\n      \"options\": {},\n      \"pageSize\": null,\n      \"repeat\": \"Database\",\n      \"repeatDirection\": \"v\",\n      \"scopedVars\": {\n        \"Database\": {\n          \"selected\": true,\n          \"text\": \"All\",\n          \"value\": \"All\"\n        }\n      },\n      \"scroll\": true,\n      \"showHeader\": true,\n      \"sort\": {\n        \"col\": 4,\n        \"desc\": true\n      },\n      \"styles\": [\n        {\n          \"alias\": \"Table\",\n          \"align\": \"auto\",\n          \"dateFormat\": \"YYYY-MM-DD HH:mm:ss\",\n          \"pattern\": \"table_name.keyword\",\n          \"type\": \"string\"\n        },\n        {\n          \"alias\": \"Index\",\n          \"align\": \"auto\",\n          \"colorMode\": \"value\",\n          \"colors\": [\n            \"rgba(50, 172, 45, 0.97)\",\n            \"rgba(237, 129, 40, 0.89)\",\n            \"rgba(245, 54, 54, 0.9)\"\n          ],\n          \"decimals\": 2,\n          \"pattern\": \"index_name.keyword\",\n          \"thresholds\": [\n            \"60\",\n            \"80\",\n            \"90\"\n          ],\n          \"type\": \"string\",\n          \"unit\": \"percent\"\n        },\n        {\n          \"alias\": \"Scans\",\n          \"align\": \"auto\",\n          \"colorMode\": null,\n          \"colors\": [\n            \"rgba(245, 54, 54, 0.9)\",\n            \"rgba(237, 129, 40, 0.89)\",\n            \"rgba(50, 172, 45, 0.97)\"\n          ],\n          \"dateFormat\": \"YYYY-MM-DD HH:mm:ss\",\n          \"decimals\": 0,\n          \"mappingType\": 1,\n          \"pattern\": \"Average user_scans\",\n          \"sanitize\": false,\n          \"thresholds\": [],\n          \"type\": \"number\",\n          \"unit\": \"none\"\n        },\n        {\n          \"alias\": \"Seeks\",\n          \"align\": \"auto\",\n          \"colorMode\": null,\n          \"colors\": [\n            \"rgba(245, 54, 54, 0.9)\",\n            \"rgba(237, 129, 40, 0.89)\",\n            \"rgba(50, 172, 45, 0.97)\"\n          ],\n          \"dateFormat\": \"YYYY-MM-DD HH:mm:ss\",\n          \"decimals\": 0,\n          \"mappingType\": 1,\n          \"pattern\": \"Average user_seeks\",\n          \"thresholds\": [],\n          \"type\": \"number\",\n          \"unit\": \"none\"\n        },\n        {\n          \"alias\": \"Lookups\",\n          \"align\": \"auto\",\n          \"colorMode\": null,\n          \"colors\": [\n            \"rgba(245, 54, 54, 0.9)\",\n            \"rgba(237, 129, 40, 0.89)\",\n            \"rgba(50, 172, 45, 0.97)\"\n          ],\n          \"dateFormat\": \"YYYY-MM-DD HH:mm:ss\",\n          \"decimals\": 0,\n          \"mappingType\": 1,\n          \"pattern\": \"Average user_lookups\",\n          \"thresholds\": [],\n          \"type\": \"number\",\n          \"unit\": \"none\"\n        },\n        {\n          \"alias\": \"Updates\",\n          \"align\": \"auto\",\n          \"colorMode\": null,\n          \"colors\": [\n            \"rgba(245, 54, 54, 0.9)\",\n            \"rgba(237, 129, 40, 0.89)\",\n            \"rgba(50, 172, 45, 0.97)\"\n          ],\n          \"dateFormat\": \"YYYY-MM-DD HH:mm:ss\",\n          \"decimals\": 0,\n          \"mappingType\": 1,\n          \"pattern\": \"Average user_updates\",\n          \"thresholds\": [],\n          \"type\": \"number\",\n          \"unit\": \"none\"\n        },\n        {\n          \"alias\": \"Total index usages\",\n          \"align\": \"auto\",\n          \"colorMode\": null,\n          \"colors\": [\n            \"rgba(245, 54, 54, 0.9)\",\n            \"rgba(237, 129, 40, 0.89)\",\n            \"rgba(50, 172, 45, 0.97)\"\n          ],\n          \"dateFormat\": \"YYYY-MM-DD HH:mm:ss\",\n          \"decimals\": 0,\n          \"mappingType\": 1,\n          \"pattern\": \"bucket\",\n          \"thresholds\": [],\n          \"type\": \"number\",\n          \"unit\": \"none\"\n        }\n      ],\n      \"targets\": [\n        {\n          \"alias\": \"\",\n          \"bucketAggs\": [\n            {\n              \"fake\": true,\n              \"field\": \"table_name.keyword\",\n              \"id\": \"4\",\n              \"settings\": {\n                \"min_doc_count\": 1,\n                \"order\": \"desc\",\n                \"orderBy\": \"9\",\n                \"size\": \"0\"\n              },\n              \"type\": \"terms\"\n            },\n            {\n              \"fake\": true,\n              \"field\": \"index_name.keyword\",\n              \"id\": \"3\",\n              \"settings\": {\n                \"min_doc_count\": 1,\n                \"order\": \"desc\",\n                \"orderBy\": \"9\",\n                \"size\": \"0\"\n              },\n              \"type\": \"terms\"\n            }\n          ],\n          \"hide\": true,\n          \"metrics\": [\n            {\n              \"field\": \"user_scans\",\n              \"id\": \"5\",\n              \"meta\": {},\n              \"settings\": {},\n              \"type\": \"avg\"\n            },\n            {\n              \"field\": \"user_seeks\",\n              \"id\": \"6\",\n              \"meta\": {},\n              \"settings\": {},\n              \"type\": \"avg\"\n            },\n            {\n              \"field\": \"user_lookups\",\n              \"id\": \"7\",\n              \"meta\": {},\n              \"settings\": {},\n              \"type\": \"avg\"\n            },\n            {\n              \"field\": \"user_updates\",\n              \"id\": \"8\",\n              \"meta\": {},\n              \"settings\": {},\n              \"type\": \"avg\"\n            },\n            {\n              \"field\": \"select field\",\n              \"id\": \"9\",\n              \"meta\": {},\n              \"pipelineVariables\": [\n                {\n                  \"name\": \"var1\",\n                  \"pipelineAgg\": \"5\"\n                },\n                {\n                  \"name\": \"var2\",\n                  \"pipelineAgg\": \"6\"\n                },\n                {\n                  \"name\": \"var3\",\n                  \"pipelineAgg\": \"7\"\n                }\n              ],\n              \"settings\": {\n                \"script\": \"params.var1+params.var2+params.var3\"\n              },\n              \"type\": \"bucket_script\"\n            }\n          ],\n          \"query\": \"database_name.keyword:$Database\",\n          \"refId\": \"A\",\n          \"timeField\": \"@timestamp\"\n        },\n        {\n          \"bucketAggs\": [\n            {\n              \"fake\": true,\n              \"field\": \"table_name.keyword\",\n              \"id\": \"3\",\n              \"settings\": {\n                \"min_doc_count\": 1,\n                \"order\": \"desc\",\n                \"orderBy\": \"4\",\n                \"size\": \"0\"\n              },\n              \"type\": \"terms\"\n            },\n            {\n              \"fake\": true,\n              \"field\": \"index_name.keyword\",\n              \"id\": \"9\",\n              \"settings\": {\n                \"min_doc_count\": 1,\n                \"order\": \"desc\",\n                \"orderBy\": \"4\",\n                \"size\": \"10\"\n              },\n              \"type\": \"terms\"\n            }\n          ],\n          \"metrics\": [\n            {\n              \"field\": \"user_scans\",\n              \"id\": \"4\",\n              \"meta\": {},\n              \"settings\": {},\n              \"type\": \"avg\"\n            },\n            {\n              \"field\": \"user_seeks\",\n              \"id\": \"5\",\n              \"meta\": {},\n              \"settings\": {},\n              \"type\": \"avg\"\n            },\n            {\n              \"field\": \"user_lookups\",\n              \"id\": \"6\",\n              \"meta\": {},\n              \"settings\": {},\n              \"type\": \"avg\"\n            },\n            {\n              \"field\": \"user_updates\",\n              \"id\": \"7\",\n              \"meta\": {},\n              \"settings\": {},\n              \"type\": \"avg\"\n            }\n          ],\n          \"query\": \"database_name.keyword:$Database\",\n          \"refId\": \"B\",\n          \"timeField\": \"@timestamp\"\n        }\n      ],\n      \"timeFrom\": null,\n      \"timeShift\": null,\n      \"title\": \"Index usage - $Database\",\n      \"transform\": \"table\",\n      \"type\": \"table\"\n    },\n    {\n      \"collapsed\": false,\n      \"datasource\": null,\n      \"gridPos\": {\n        \"h\": 1,\n        \"w\": 24,\n        \"x\": 0,\n        \"y\": 6\n      },\n      \"id\": 76,\n      \"panels\": [],\n      \"title\": \"Underutilised indexes\",\n      \"type\": \"row\"\n    },\n    {\n      \"cacheTimeout\": null,\n      \"columns\": [],\n      \"datasource\": \"Elasticsearch [index-stats]\",\n      \"fontSize\": \"100%\",\n      \"gridPos\": {\n        \"h\": 7,\n        \"w\": 24,\n        \"x\": 0,\n        \"y\": 7\n      },\n      \"id\": 58,\n      \"links\": [],\n      \"options\": {},\n      \"pageSize\": null,\n      \"repeat\": \"Database\",\n      \"repeatDirection\": \"h\",\n      \"scopedVars\": {\n        \"Database\": {\n          \"selected\": true,\n          \"text\": \"\",\n          \"value\": \"\"\n        }\n      },\n      \"showHeader\": true,\n      \"sort\": {\n        \"col\": 3,\n        \"desc\": true\n      },\n      \"styles\": [\n        {\n          \"alias\": \"Table\",\n          \"align\": \"auto\",\n          \"dateFormat\": \"YYYY-MM-DD HH:mm:ss\",\n          \"pattern\": \"table_name.keyword\",\n          \"type\": \"string\"\n        },\n        {\n          \"alias\": \"Index\",\n          \"align\": \"auto\",\n          \"colorMode\": null,\n          \"colors\": [\n            \"rgba(245, 54, 54, 0.9)\",\n            \"rgba(237, 129, 40, 0.89)\",\n            \"rgba(50, 172, 45, 0.97)\"\n          ],\n          \"decimals\": 2,\n          \"pattern\": \"index_name.keyword\",\n          \"thresholds\": [],\n          \"type\": \"string\",\n          \"unit\": \"short\"\n        },\n        {\n          \"alias\": \"Lookups\",\n          \"align\": \"auto\",\n          \"colorMode\": null,\n          \"colors\": [\n            \"rgba(245, 54, 54, 0.9)\",\n            \"rgba(237, 129, 40, 0.89)\",\n            \"rgba(50, 172, 45, 0.97)\"\n          ],\n          \"dateFormat\": \"YYYY-MM-DD HH:mm:ss\",\n          \"decimals\": 0,\n          \"mappingType\": 1,\n          \"pattern\": \"Average user_lookups\",\n          \"thresholds\": [],\n          \"type\": \"number\",\n          \"unit\": \"short\"\n        },\n        {\n          \"alias\": \"Scans\",\n          \"align\": \"auto\",\n          \"colorMode\": null,\n          \"colors\": [\n            \"rgba(245, 54, 54, 0.9)\",\n            \"rgba(237, 129, 40, 0.89)\",\n            \"rgba(50, 172, 45, 0.97)\"\n          ],\n          \"dateFormat\": \"YYYY-MM-DD HH:mm:ss\",\n          \"decimals\": 0,\n          \"mappingType\": 1,\n          \"pattern\": \"Average user_scans\",\n          \"thresholds\": [],\n          \"type\": \"number\",\n          \"unit\": \"short\"\n        },\n        {\n          \"alias\": \"Seeks\",\n          \"align\": \"auto\",\n          \"colorMode\": null,\n          \"colors\": [\n            \"rgba(245, 54, 54, 0.9)\",\n            \"rgba(237, 129, 40, 0.89)\",\n            \"rgba(50, 172, 45, 0.97)\"\n          ],\n          \"dateFormat\": \"YYYY-MM-DD HH:mm:ss\",\n          \"decimals\": 0,\n          \"mappingType\": 1,\n          \"pattern\": \"Average user_seeks\",\n          \"thresholds\": [],\n          \"type\": \"number\",\n          \"unit\": \"short\"\n        },\n        {\n          \"alias\": \"Total Usage\",\n          \"align\": \"auto\",\n          \"colorMode\": null,\n          \"colors\": [\n            \"rgba(245, 54, 54, 0.9)\",\n            \"rgba(237, 129, 40, 0.89)\",\n            \"rgba(50, 172, 45, 0.97)\"\n          ],\n          \"dateFormat\": \"YYYY-MM-DD HH:mm:ss\",\n          \"decimals\": 3,\n          \"mappingType\": 1,\n          \"pattern\": \"Bucket Script\",\n          \"thresholds\": [],\n          \"type\": \"number\",\n          \"unit\": \"short\"\n        },\n        {\n          \"alias\": \"Updates\",\n          \"align\": \"auto\",\n          \"colorMode\": null,\n          \"colors\": [\n            \"rgba(245, 54, 54, 0.9)\",\n            \"rgba(237, 129, 40, 0.89)\",\n            \"rgba(50, 172, 45, 0.97)\"\n          ],\n          \"dateFormat\": \"YYYY-MM-DD HH:mm:ss\",\n          \"decimals\": 0,\n          \"mappingType\": 1,\n          \"pattern\": \"Average user_updates\",\n          \"thresholds\": [],\n          \"type\": \"number\",\n          \"unit\": \"short\"\n        }\n      ],\n      \"targets\": [\n        {\n          \"alias\": \"{{table_name.keyword}}.{{index_name.keyword}}\",\n          \"bucketAggs\": [\n            {\n              \"fake\": true,\n              \"field\": \"table_name.keyword\",\n              \"id\": \"5\",\n              \"settings\": {\n                \"min_doc_count\": 1,\n                \"order\": \"desc\",\n                \"orderBy\": \"6\",\n                \"size\": \"5\"\n              },\n              \"type\": \"terms\"\n            },\n            {\n              \"fake\": true,\n              \"field\": \"index_name.keyword\",\n              \"id\": \"3\",\n              \"settings\": {\n                \"min_doc_count\": 1,\n                \"order\": \"desc\",\n                \"orderBy\": \"6\",\n                \"size\": \"10\"\n              },\n              \"type\": \"terms\"\n            }\n          ],\n          \"metrics\": [\n            {\n              \"field\": \"user_lookups\",\n              \"hide\": true,\n              \"id\": \"1\",\n              \"meta\": {},\n              \"settings\": {},\n              \"type\": \"avg\"\n            },\n            {\n              \"field\": \"user_scans\",\n              \"hide\": true,\n              \"id\": \"6\",\n              \"meta\": {},\n              \"settings\": {},\n              \"type\": \"avg\"\n            },\n            {\n              \"field\": \"user_seeks\",\n              \"hide\": true,\n              \"id\": \"7\",\n              \"meta\": {},\n              \"settings\": {},\n              \"type\": \"avg\"\n            },\n            {\n              \"field\": \"select field\",\n              \"id\": \"8\",\n              \"meta\": {},\n              \"pipelineVariables\": [\n                {\n                  \"name\": \"var1\",\n                  \"pipelineAgg\": \"1\"\n                },\n                {\n                  \"name\": \"var2\",\n                  \"pipelineAgg\": \"6\"\n                },\n                {\n                  \"name\": \"var3\",\n                  \"pipelineAgg\": \"7\"\n                },\n                {\n                  \"name\": \"var4\",\n                  \"pipelineAgg\": \"9\"\n                }\n              ],\n              \"settings\": {\n                \"script\": \"params.var4\/(params.var1+params.var2+params.var3)\"\n              },\n              \"type\": \"bucket_script\"\n            },\n            {\n              \"field\": \"user_updates\",\n              \"hide\": true,\n              \"id\": \"9\",\n              \"meta\": {},\n              \"settings\": {},\n              \"type\": \"avg\"\n            }\n          ],\n          \"query\": \"database_name.keyword:$Database AND user_lookups:[0 TO 100] AND user_scans:[0 TO 100] AND user_seeks:[0 TO 100]\",\n          \"refId\": \"A\",\n          \"timeField\": \"@timestamp\"\n        }\n      ],\n      \"timeFrom\": null,\n      \"timeShift\": null,\n      \"title\": \"$Database - Underutilised indexes\",\n      \"transform\": \"table\",\n      \"type\": \"table\"\n    },\n    {\n      \"collapsed\": false,\n      \"datasource\": null,\n      \"gridPos\": {\n        \"h\": 1,\n        \"w\": 24,\n        \"x\": 0,\n        \"y\": 14\n      },\n      \"id\": 91,\n      \"panels\": [],\n      \"title\": \"Missing Indexes\",\n      \"type\": \"row\"\n    },\n    {\n      \"columns\": [],\n      \"datasource\": \"Elasticsearch [missing-indexes]\",\n      \"fontSize\": \"100%\",\n      \"gridPos\": {\n        \"h\": 5,\n        \"w\": 24,\n        \"x\": 0,\n        \"y\": 15\n      },\n      \"id\": 89,\n      \"interval\": \"30m\",\n      \"links\": [],\n      \"maxPerRow\": 2,\n      \"options\": {},\n      \"pageSize\": null,\n      \"repeat\": \"Database\",\n      \"repeatDirection\": \"v\",\n      \"scopedVars\": {\n        \"Database\": {\n          \"selected\": true,\n          \"text\": \"\",\n          \"value\": \"\"\n        }\n      },\n      \"scroll\": true,\n      \"showHeader\": true,\n      \"sort\": {\n        \"col\": 6,\n        \"desc\": true\n      },\n      \"styles\": [\n        {\n          \"alias\": \"Table\",\n          \"align\": \"auto\",\n          \"dateFormat\": \"YYYY-MM-DD HH:mm:ss\",\n          \"pattern\": \"table_name.keyword\",\n          \"type\": \"string\"\n        },\n        {\n          \"alias\": \"Index\",\n          \"align\": \"auto\",\n          \"colorMode\": \"value\",\n          \"colors\": [\n            \"rgba(50, 172, 45, 0.97)\",\n            \"rgba(237, 129, 40, 0.89)\",\n            \"rgba(245, 54, 54, 0.9)\"\n          ],\n          \"decimals\": 2,\n          \"pattern\": \"sql_code.keyword\",\n          \"thresholds\": [\n            \"\"\n          ],\n          \"type\": \"string\",\n          \"unit\": \"percent\"\n        },\n        {\n          \"alias\": \"Impact\",\n          \"align\": \"auto\",\n          \"colorMode\": null,\n          \"colors\": [\n            \"rgba(245, 54, 54, 0.9)\",\n            \"rgba(237, 129, 40, 0.89)\",\n            \"rgba(50, 172, 45, 0.97)\"\n          ],\n          \"dateFormat\": \"YYYY-MM-DD HH:mm:ss\",\n          \"decimals\": 2,\n          \"mappingType\": 1,\n          \"pattern\": \"Average\",\n          \"sanitize\": false,\n          \"thresholds\": [],\n          \"type\": \"number\",\n          \"unit\": \"none\"\n        },\n        {\n          \"alias\": \"Seeks\",\n          \"align\": \"auto\",\n          \"colorMode\": null,\n          \"colors\": [\n            \"rgba(245, 54, 54, 0.9)\",\n            \"rgba(237, 129, 40, 0.89)\",\n            \"rgba(50, 172, 45, 0.97)\"\n          ],\n          \"dateFormat\": \"YYYY-MM-DD HH:mm:ss\",\n          \"decimals\": 0,\n          \"mappingType\": 1,\n          \"pattern\": \"Average user_seeks\",\n          \"thresholds\": [],\n          \"type\": \"number\",\n          \"unit\": \"none\"\n        }\n      ],\n      \"targets\": [\n        {\n          \"alias\": \"\",\n          \"bucketAggs\": [\n            {\n              \"fake\": true,\n              \"field\": \"table_name.keyword\",\n              \"id\": \"11\",\n              \"settings\": {\n                \"min_doc_count\": 1,\n                \"order\": \"desc\",\n                \"orderBy\": \"10\",\n                \"size\": \"0\"\n              },\n              \"type\": \"terms\"\n            },\n            {\n              \"fake\": true,\n              \"field\": \"sql_code.keyword\",\n              \"id\": \"4\",\n              \"settings\": {\n                \"min_doc_count\": 1,\n                \"order\": \"desc\",\n                \"orderBy\": \"10\",\n                \"size\": \"0\"\n              },\n              \"type\": \"terms\"\n            }\n          ],\n          \"metrics\": [\n            {\n              \"field\": \"overall_impact\",\n              \"id\": \"10\",\n              \"meta\": {},\n              \"settings\": {},\n              \"type\": \"avg\"\n            }\n          ],\n          \"query\": \"database_name.keyword:$Database\",\n          \"refId\": \"A\",\n          \"timeField\": \"@timestamp\"\n        }\n      ],\n      \"timeFrom\": null,\n      \"timeShift\": null,\n      \"title\": \"Missing indexes - $Database\",\n      \"transform\": \"table\",\n      \"type\": \"table\"\n    }\n  ],\n  \"refresh\": false,\n  \"schemaVersion\": 22,\n  \"style\": \"dark\",\n  \"tags\": [],\n  \"templating\": {\n    \"list\": [\n      {\n        \"allValue\": null,\n        \"current\": {\n          \"text\": \"\",\n          \"value\": [\n            \"\"\n          ]\n        },\n        \"datasource\": \"Elasticsearch [index-stats]\",\n        \"definition\": \"{\\\"find\\\": \\\"terms\\\",\\\"field\\\": \\\"database_name.keyword\\\"}\",\n        \"hide\": 0,\n        \"includeAll\": true,\n        \"label\": null,\n        \"multi\": true,\n        \"name\": \"Database\",\n        \"options\": [],\n        \"query\": \"{\\\"find\\\": \\\"terms\\\",\\\"field\\\": \\\"database_name.keyword\\\"}\",\n        \"refresh\": 2,\n        \"regex\": \"\",\n        \"skipUrlSync\": false,\n        \"sort\": 0,\n        \"tagValuesQuery\": \"\",\n        \"tags\": [],\n        \"tagsQuery\": \"\",\n        \"type\": \"query\",\n        \"useTags\": false\n      }\n    ]\n  },\n  \"time\": {\n    \"from\": \"now-24h\",\n    \"to\": \"now\"\n  },\n  \"timepicker\": {\n    \"refresh_intervals\": [\n      \"5s\",\n      \"10s\",\n      \"30s\",\n      \"1m\",\n      \"5m\",\n      \"15m\",\n      \"30m\",\n      \"1h\",\n      \"2h\",\n      \"1d\"\n    ],\n    \"time_options\": [\n      \"5m\",\n      \"15m\",\n      \"1h\",\n      \"6h\",\n      \"12h\",\n      \"24h\",\n      \"2d\",\n      \"7d\",\n      \"30d\"\n    ]\n  },\n  \"timezone\": \"\",\n  \"title\": \"Index Maintenance\",\n  \"uid\": \"OQVK9BSWk\",\n  \"version\": 27\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Now that we&#8217;ve got basic SQL queries going, we want to collect some actionable intel. A good measure of any SQL database performance is how well indexes are utilised. This isn&#8217;t new All queries we&#8217;re about to share are hardly a revelation. What we however want to achieve is to have an idea of how &hellip; <a href=\"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/10\/18\/monitoring-sql-server-index-maintenance\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Monitoring SQL Server: index maintenance&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":465,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[7],"tags":[38,59],"class_list":["post-433","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-infrastructure","tag-monitoring","tag-sql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Monitoring SQL Server: index maintenance - Timur and associates<\/title>\n<meta name=\"description\" content=\"Collecting SQL Server index maintenance stats over time with Logstash. Missing indexes, fragmentation, and usage patterns.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/10\/18\/monitoring-sql-server-index-maintenance\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Monitoring SQL Server: index maintenance - Timur and associates\" \/>\n<meta property=\"og:description\" content=\"Collecting SQL Server index maintenance stats over time with Logstash. Missing indexes, fragmentation, and usage patterns.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/10\/18\/monitoring-sql-server-index-maintenance\/\" \/>\n<meta property=\"og:site_name\" content=\"Timur and associates\" \/>\n<meta property=\"article:published_time\" content=\"2019-10-17T16:08:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-07T11:44:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.wiseowls.co.nz\/wp-content\/uploads\/2020\/03\/elk_1920.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"778\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"timur\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@TimurKh\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/10\\\/18\\\/monitoring-sql-server-index-maintenance\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/10\\\/18\\\/monitoring-sql-server-index-maintenance\\\/\"},\"author\":{\"name\":\"timur\",\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/#\\\/schema\\\/person\\\/34d0ed30d573b5bc317ea990bd2e0c59\"},\"headline\":\"Monitoring SQL Server: index maintenance\",\"datePublished\":\"2019-10-17T16:08:00+00:00\",\"dateModified\":\"2026-03-07T11:44:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/10\\\/18\\\/monitoring-sql-server-index-maintenance\\\/\"},\"wordCount\":142,\"image\":{\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/10\\\/18\\\/monitoring-sql-server-index-maintenance\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/elk_1920.jpg\",\"keywords\":[\"monitoring\",\"sql\"],\"articleSection\":[\"Infrastructure\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/10\\\/18\\\/monitoring-sql-server-index-maintenance\\\/\",\"url\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/10\\\/18\\\/monitoring-sql-server-index-maintenance\\\/\",\"name\":\"Monitoring SQL Server: index maintenance - Timur and associates\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/10\\\/18\\\/monitoring-sql-server-index-maintenance\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/10\\\/18\\\/monitoring-sql-server-index-maintenance\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/elk_1920.jpg\",\"datePublished\":\"2019-10-17T16:08:00+00:00\",\"dateModified\":\"2026-03-07T11:44:46+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/#\\\/schema\\\/person\\\/34d0ed30d573b5bc317ea990bd2e0c59\"},\"description\":\"Collecting SQL Server index maintenance stats over time with Logstash. Missing indexes, fragmentation, and usage patterns.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/10\\\/18\\\/monitoring-sql-server-index-maintenance\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/10\\\/18\\\/monitoring-sql-server-index-maintenance\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/10\\\/18\\\/monitoring-sql-server-index-maintenance\\\/#primaryimage\",\"url\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/elk_1920.jpg\",\"contentUrl\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/elk_1920.jpg\",\"width\":1920,\"height\":778},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/index.php\\\/2019\\\/10\\\/18\\\/monitoring-sql-server-index-maintenance\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Monitoring SQL Server: index maintenance\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/#website\",\"url\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/\",\"name\":\"Timur and associates\",\"description\":\"Notes of an IT contractor\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/blog.wiseowls.co.nz\\\/#\\\/schema\\\/person\\\/34d0ed30d573b5bc317ea990bd2e0c59\",\"name\":\"timur\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/23d55e17d4f0990ee4d12bc6e5dcfb58a292934efd62a185756876379e780b16?s=96&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/23d55e17d4f0990ee4d12bc6e5dcfb58a292934efd62a185756876379e780b16?s=96&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/23d55e17d4f0990ee4d12bc6e5dcfb58a292934efd62a185756876379e780b16?s=96&r=pg\",\"caption\":\"timur\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/TimurKh\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Monitoring SQL Server: index maintenance - Timur and associates","description":"Collecting SQL Server index maintenance stats over time with Logstash. Missing indexes, fragmentation, and usage patterns.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/10\/18\/monitoring-sql-server-index-maintenance\/","og_locale":"en_US","og_type":"article","og_title":"Monitoring SQL Server: index maintenance - Timur and associates","og_description":"Collecting SQL Server index maintenance stats over time with Logstash. Missing indexes, fragmentation, and usage patterns.","og_url":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/10\/18\/monitoring-sql-server-index-maintenance\/","og_site_name":"Timur and associates","article_published_time":"2019-10-17T16:08:00+00:00","article_modified_time":"2026-03-07T11:44:46+00:00","og_image":[{"width":1920,"height":778,"url":"https:\/\/blog.wiseowls.co.nz\/wp-content\/uploads\/2020\/03\/elk_1920.jpg","type":"image\/jpeg"}],"author":"timur","twitter_card":"summary_large_image","twitter_creator":"@TimurKh","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/10\/18\/monitoring-sql-server-index-maintenance\/#article","isPartOf":{"@id":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/10\/18\/monitoring-sql-server-index-maintenance\/"},"author":{"name":"timur","@id":"https:\/\/blog.wiseowls.co.nz\/#\/schema\/person\/34d0ed30d573b5bc317ea990bd2e0c59"},"headline":"Monitoring SQL Server: index maintenance","datePublished":"2019-10-17T16:08:00+00:00","dateModified":"2026-03-07T11:44:46+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/10\/18\/monitoring-sql-server-index-maintenance\/"},"wordCount":142,"image":{"@id":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/10\/18\/monitoring-sql-server-index-maintenance\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.wiseowls.co.nz\/wp-content\/uploads\/2020\/03\/elk_1920.jpg","keywords":["monitoring","sql"],"articleSection":["Infrastructure"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/10\/18\/monitoring-sql-server-index-maintenance\/","url":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/10\/18\/monitoring-sql-server-index-maintenance\/","name":"Monitoring SQL Server: index maintenance - Timur and associates","isPartOf":{"@id":"https:\/\/blog.wiseowls.co.nz\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/10\/18\/monitoring-sql-server-index-maintenance\/#primaryimage"},"image":{"@id":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/10\/18\/monitoring-sql-server-index-maintenance\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.wiseowls.co.nz\/wp-content\/uploads\/2020\/03\/elk_1920.jpg","datePublished":"2019-10-17T16:08:00+00:00","dateModified":"2026-03-07T11:44:46+00:00","author":{"@id":"https:\/\/blog.wiseowls.co.nz\/#\/schema\/person\/34d0ed30d573b5bc317ea990bd2e0c59"},"description":"Collecting SQL Server index maintenance stats over time with Logstash. Missing indexes, fragmentation, and usage patterns.","breadcrumb":{"@id":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/10\/18\/monitoring-sql-server-index-maintenance\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/10\/18\/monitoring-sql-server-index-maintenance\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/10\/18\/monitoring-sql-server-index-maintenance\/#primaryimage","url":"https:\/\/blog.wiseowls.co.nz\/wp-content\/uploads\/2020\/03\/elk_1920.jpg","contentUrl":"https:\/\/blog.wiseowls.co.nz\/wp-content\/uploads\/2020\/03\/elk_1920.jpg","width":1920,"height":778},{"@type":"BreadcrumbList","@id":"https:\/\/blog.wiseowls.co.nz\/index.php\/2019\/10\/18\/monitoring-sql-server-index-maintenance\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.wiseowls.co.nz\/"},{"@type":"ListItem","position":2,"name":"Monitoring SQL Server: index maintenance"}]},{"@type":"WebSite","@id":"https:\/\/blog.wiseowls.co.nz\/#website","url":"https:\/\/blog.wiseowls.co.nz\/","name":"Timur and associates","description":"Notes of an IT contractor","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.wiseowls.co.nz\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blog.wiseowls.co.nz\/#\/schema\/person\/34d0ed30d573b5bc317ea990bd2e0c59","name":"timur","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/23d55e17d4f0990ee4d12bc6e5dcfb58a292934efd62a185756876379e780b16?s=96&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/23d55e17d4f0990ee4d12bc6e5dcfb58a292934efd62a185756876379e780b16?s=96&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/23d55e17d4f0990ee4d12bc6e5dcfb58a292934efd62a185756876379e780b16?s=96&r=pg","caption":"timur"},"sameAs":["https:\/\/x.com\/TimurKh"]}]}},"_links":{"self":[{"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/posts\/433","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/comments?post=433"}],"version-history":[{"count":4,"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/posts\/433\/revisions"}],"predecessor-version":[{"id":484,"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/posts\/433\/revisions\/484"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/media\/465"}],"wp:attachment":[{"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/media?parent=433"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/categories?post=433"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.wiseowls.co.nz\/index.php\/wp-json\/wp\/v2\/tags?post=433"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}