You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: setup/install_open_query_store_base.sql
+14-5Lines changed: 14 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -41,23 +41,32 @@ IF NOT EXISTS ( SELECT * FROM [sys].[schemas] AS [S] WHERE [S].[name] = 'oqs' )
41
41
EXEC ( 'CREATE SCHEMA oqs' );
42
42
END;
43
43
GO
44
-
45
-
-- Metadata to control OQS
46
44
CREATETABLE [oqs].[collection_metadata]
47
45
(
48
46
[command] nvarchar (2000) NOTNULL, -- The command that should be executed by Service Broker
49
47
[collection_interval] bigintNOTNULL, -- The interval for looped processing (in seconds)
50
-
[oqs_mode] varchar(11) NOTNULL, -- The mode that OQS should run in. May only be "classic" or "centralized"
48
+
[oqs_mode] varchar (11)NOTNULL, -- The mode that OQS should run in. May only be "classic" or "centralized"
51
49
[oqs_classic_db] nvarchar (128) NOTNULL, -- The database where OQS resides in classic mode (must be filled when classic mode is chosen, ignored by centralized mode)
52
50
[collection_active] bitNOTNULL, -- Should OQS be collecting data or not
53
51
[execution_threshold] tinyintNOTNULL, -- The minimum executions of a query plan before we consider it for capture in OQS
54
52
[data_cleanup_active] bitNOTNULL, -- Should OQS automatically clean up old data
55
53
[data_cleanup_threshold] tinyintNOTNULL, -- How many days should OQS keep data for (automated cleanup removes data older than this)
56
54
[data_cleanup_throttle] smallintNOTNULL, -- How many rows can be deleted in one pass. This avoids large deletions from trashing the transaction log and blocking OQS tables.
57
-
CONSTRAINT [chk_oqs_mode] CHECK ( [oqs_mode] IN ( N'classic', N'centralized' ))
55
+
58
56
);
59
57
GO
60
58
59
+
-- We want to have defaults and checks for certain settings
60
+
ALTERTABLE [oqs].[collection_metadata]
61
+
ADDCONSTRAINT [chk_oqs_mode] CHECK ( [oqs_mode] IN ( N'classic', N'centralized' )),
62
+
CONSTRAINT [df_collection_interval] DEFAULT ( 60 ) FOR [collection_interval],
63
+
CONSTRAINT [df_collection_active] DEFAULT ( 0 ) FOR [collection_active],
64
+
CONSTRAINT [df_execution_threshold] DEFAULT ( 2 ) FOR [execution_threshold],
65
+
CONSTRAINT [df_cleanup_active] DEFAULT ( 0 ) FOR [data_cleanup_active],
66
+
CONSTRAINT [df_cleanup_threshold] DEFAULT ( 2 ) FOR [data_cleanup_threshold],
67
+
CONSTRAINT [df_cleanup_throttle] DEFAULT ( 5000 ) FOR [data_cleanup_throttle];
68
+
69
+
61
70
-- Semi-hidden way of documenting the version of OQS that is installed. The value will be automatically bumped upon a new version build/release
0 commit comments