From ccefc4271172a79a04cf9c1277e7a4c6e0dd6338 Mon Sep 17 00:00:00 2001 From: denzilribeiro Date: Tue, 31 Mar 2020 14:54:22 -0500 Subject: [PATCH] Add OPTION RECOMPILE for perf reasons due to temp table (#7242) --- plugins/inputs/sqlserver/sqlserver.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/inputs/sqlserver/sqlserver.go b/plugins/inputs/sqlserver/sqlserver.go index c69db611a..0cd1453ab 100644 --- a/plugins/inputs/sqlserver/sqlserver.go +++ b/plugins/inputs/sqlserver/sqlserver.go @@ -790,7 +790,8 @@ FROM @PCounters AS pc AND pc.object_name = pc1.object_name AND pc.instance_name = pc1.instance_name AND pc1.counter_name LIKE '%base' -WHERE pc.counter_name NOT LIKE '% base'; +WHERE pc.counter_name NOT LIKE '% base' +OPTION(RECOMPILE); ` // Conditional check based on Azure SQL DB v/s the rest aka (Azure SQL Managed instance OR On-prem SQL Server)