Automatic tuning in SQL databases, respectively in SQL Azure datsbases, is a fully managed performance service that uses built-in intelligence to continuously monitor queries executed and automatically improve their performance [1]. At least in SQL databases the target is to fully automate indexes' maintenance by providing automated tuning, verification of performance gains, rollback and self-correction, respectively tuning history. The future sounds promising, though the question is what's already available.
The documentation references several objects made available already for this feature. sys.database_automatic_tuning_options returns the tuning options available for the database:
-- SQL databases - automatic tuning options SELECT ATO.name , ATO.desired_state , ATO.desired_state_desc , ATO.actual_state , ATO.actual_state_desc , ATO.reason , ATO.reason_desc FROM sys.database_automatic_tuning_options ATO ORDER BY ATO.name
name | desired_state | desired_state_desc | actual_state | actual_state_desc | reason | reason_desc |
CREATE_INDEX | 2 | DEFAULT | 1 | ON | 3 | INHERITED_FROM_SERVER |
DROP_INDEX | 2 | DEFAULT | 1 | ON | 3 | INHERITED_FROM_SERVER |
FORCE_LAST_GOOD_PLAN | 2 | DEFAULT | 1 | ON | 3 | INHERITED_FROM_SERVER |
MAINTAIN_INDEX | 2 | DEFAULT | 0 | OFF | 3 | INHERITED_FROM_SERVER |
For further information see the automatic tuning options in the documentation [2], respectively [1] for an overview of the feature.
There's a sys.database_automatic_tuning_mode and a sys.database_automatic_tuning_configurations, though on the SQL database instance only the first has records.
-- SQL databases - automatic tuning mode SELECT ATM.desired_state , ATM.desired_state_desc , ATM.actual_state , ATM.actual_state_desc FROM sys.database_automatic_tuning_mode ATM
desired_state | desired_state_desc | actual_state | actual_state_desc |
1 | INHERIT | 3 | AUTO |
-- disabling database properties ALTER DATABASE [AdventureWorks01] SET AUTOMATIC_TUNING ( FORCE_LAST_GOOD_PLAN = OFF);
"Msg 16202, Level 16, State 162, Line 1, Keyword or statement option 'SET' is not supported on the 'Microsoft Fabric' platform."
The automatic index tab report trom the Performance Dashboard for SQL database shows the history and status of automatically created indexes [5]. See Home toolbar in the Query Editor window >> Performance summary >> Automatic indexes.
Taking a look at the indexes already available in AdventureWorks database, there seem no new indexes created since database's creation (see the definition of the referenced object):
-- sys metadata - index columns SELECt IND.db_name , IND.schema_name , IND.table_name , IND.index_name , IND.index_type , IND.principal_type , IND.auto_created FROM meta.vIndexes IND WHERE IND.schema_name = 'SalesLT' AND IND.auto_created = 1 ORDER BY IND.table_name , IND.index_name
Stay tuned! More tests on the way...
Happy coding!
Previous Post <<||>> Next Post
References:
[1] Microsoft Learn (2024) Automatic tuning [link]
[2] Microsoft Learn (2024) Performance Dashboard for SQL database in Microsoft Fabric [link]
[3] Microsoft Learn (2024) ALTER DATABASE SET options (Transact-SQL) [link]
[4] Microsoft Learn (2024) Enable automatic tuning in the Azure portal to monitor queries and improve workload performance [link]
No comments:
Post a Comment