Skip to content

Commit c16f33a

Browse files
dimitri-furmanMashaMSFT
authored andcommitted
Add temporary stats db-scoped configs
Fit and finish updating applies to locations
1 parent cac22c5 commit c16f33a

9 files changed

Lines changed: 46 additions & 14 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
author: dimitri-furman
3+
ms.author: dfurman
4+
ms.date: 01/27/2025
5+
ms.service: sql
6+
ms.topic: include
7+
ms.custom:
8+
- build-2025
9+
---
10+
Azure SQL Managed Instance<sup>[2025](/azure/azure-sql/managed-instance/update-policy#sql-server-2025-update-policy)</sup>
File renamed without changes.

docs/relational-databases/indexes/columnstore-indexes-what-s-new.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This table summarizes key features for columnstore indexes and the products in w
2626

2727
For feature availability in Azure SQL Managed Instance with a SQL Server [update policy](/azure/azure-sql/managed-instance/update-policy), refer to the column for the corresponding version of SQL Server.
2828

29-
| Columnstore Index Feature | [!INCLUDE [sssql16-md](../../includes/sssql16-md.md)]<sup>1</sup> | [!INCLUDE [ssSQL17](../../includes/sssql17-md.md)] | [!INCLUDE [sql-server-2019](../../includes/sssql19-md.md)] | [!INCLUDE [sql-server-2022](../../includes/sssql22-md.md)] | [!INCLUDE [sql-server-2025](../../includes/sssql25-md.md)] | [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)]<sup>2</sup> and [!INCLUDE [ssazure-sqlmi-autd](../../includes/ssazure-sqlmi-autd.md)] | [!INCLUDE [ssazuresynapse-md](../../includes/ssazuresynapse-md.md)] and [!INCLUDE [Warehouse](../../includes/fabric-dw.md)] |
29+
| Columnstore Index Feature | [!INCLUDE [sssql16-md](../../includes/sssql16-md.md)]<sup>1</sup> | [!INCLUDE [ssSQL17](../../includes/sssql17-md.md)] | [!INCLUDE [sql-server-2019](../../includes/sssql19-md.md)] | [!INCLUDE [sql-server-2022](../../includes/sssql22-md.md)] | [!INCLUDE [sql-server-2025](../../includes/sssql25-md.md)] | [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)]<sup>2</sup> and [!INCLUDE [ssazure-sqlmi-autd](../../includes/applies-to-version/ssazure-sqlmi-autd.md)] | [!INCLUDE [ssazuresynapse-md](../../includes/ssazuresynapse-md.md)] and [!INCLUDE [Warehouse](../../includes/fabric-dw.md)] |
3030
| --- | --- | --- | --- | --- | --- | --- | --- |
3131
| Batch mode execution for multi-threaded queries<sup>3</sup> | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
3232
| Batch mode execution for single-threaded queries | Yes | Yes | Yes | Yes | Yes | Yes | Yes |

docs/relational-databases/statistics/statistics.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: The Query Optimizer uses statistics to create query plans that impr
44
author: WilliamDAssafMSFT
55
ms.author: wiassaf
66
ms.reviewer: derekw, randolphwest
7-
ms.date: 07/07/2025
7+
ms.date: 01/27/2025
88
ms.service: sql
99
ms.subservice: performance
1010
ms.topic: concept-article
@@ -348,14 +348,18 @@ If statistics are missing, perform the following steps:
348348
- Verify that the database isn't read-only. If the database is read-only, a new statistics object can't be saved.
349349
- Create the missing statistics by using the [CREATE STATISTICS](../../t-sql/statements/create-statistics-transact-sql.md) statement.
350350

351-
When statistics on a read-only database or read-only snapshot are missing or stale, the [!INCLUDE [ssDE](../../includes/ssde-md.md)] creates and maintains temporary statistics in `tempdb`. When the [!INCLUDE [ssDE](../../includes/ssde-md.md)] creates temporary statistics, the statistics name is appended with the suffix *_readonly_database_statistic* to differentiate the temporary statistics from the permanent statistics. The suffix *_readonly_database_statistic* is reserved for statistics generated by SQL Server. Scripts for the temporary statistics can be created and reproduced on a read-write database. When scripted, [!INCLUDE [ssManStudio](../../includes/ssmanstudio-md.md)] changes the suffix of the statistics name from *_readonly_database_statistic* to *_readonly_database_statistic_scripted*.
351+
#### Temporary statistics
352352

353-
Only SQL Server can create and update temporary statistics. However, you can delete temporary statistics and monitor statistics properties using the same tools that you use for permanent statistics:
353+
When statistics on a read-only database or read-only snapshot are missing or stale, the [!INCLUDE [ssDE](../../includes/ssde-md.md)] creates and maintains temporary statistics in `tempdb`. When the [!INCLUDE [ssDE](../../includes/ssde-md.md)] creates temporary statistics, the statistics name is appended with the suffix *_readonly_database_statistic* to differentiate the temporary statistics from the permanent statistics. The suffix *_readonly_database_statistic* is reserved for statistics generated by the [!INCLUDE [ssDE](../../includes/ssde-md.md)]. Scripts for the temporary statistics can be created and executed on a read-write database. When scripted, [!INCLUDE [ssManStudio](../../includes/ssmanstudio-md.md)] changes the suffix of the statistics name from *_readonly_database_statistic* to *_readonly_database_statistic_scripted*.
354+
355+
Only the [!INCLUDE [ssDE](../../includes/ssde-md.md)] can create and update temporary statistics. However, you can delete temporary statistics and monitor statistics properties using the same tools that you use for permanent statistics:
354356

355357
- Delete temporary statistics using the [DROP STATISTICS](../../t-sql/statements/drop-statistics-transact-sql.md) statement.
356-
- Monitor statistics using the **[sys.stats](../system-catalog-views/sys-stats-transact-sql.md)** and **[sys.stats_columns](../system-catalog-views/sys-stats-columns-transact-sql.md)** catalog views. The `sys.stats` system catalog view includes the `is_temporary` column, to indicate which statistics are permanent and which are temporary.
358+
- Monitor statistics using the [sys.stats](../system-catalog-views/sys-stats-transact-sql.md) and [sys.stats_columns](../system-catalog-views/sys-stats-columns-transact-sql.md) catalog views. The `sys.stats` system catalog view includes the `is_temporary` column, to indicate which statistics are permanent and which are temporary.
359+
360+
Because temporary statistics are stored in `tempdb`, a restart of the [!INCLUDE [ssDE](../../includes/ssde-md.md)] removes all temporary statistics.
357361

358-
Because temporary statistics are stored in `tempdb`, a restart of the SQL Server service causes all temporary statistics to disappear.
362+
Just like for all statistics, creating and updating temporary statistics requires a schema modification (`Sch-M`) lock on the object. This lock might block other queries and processes, including the system redo process on secondary replicas that applies transactions from the primary replica. If this blocking affects query workloads or data propagation, you can disable the automatic creation and update of temporary statistics using the `READABLE_SECONDARY_TEMPORARY_STATS_AUTO_CREATE` and `READABLE_SECONDARY_TEMPORARY_STATS_AUTO_UPDATE` [database-scoped configurations](../../t-sql/statements/alter-database-scoped-configuration-transact-sql.md) respectively.
359363

360364
<a id="UpdateStatistics"></a>
361365

docs/relational-databases/system-catalog-views/sys-index-columns-transact-sql.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ monikerRange: ">=aps-pdw-2016 || =azuresqldb-current || =azure-sqldw-latest || >
3636
|**partition_ordinal**|**tinyint**|Ordinal (1-based) within set of partitioning columns. A clustered columnstore index can have at most one partitioning column.<br /><br />0 = Not a partitioning column.|
3737
|**is_descending_key**|**bit**|`1` = Index key column has a descending sort direction.<br /><br />`0` = Index key column has an ascending sort direction, or the column is part of a columnstore or hash index.|
3838
|**is_included_column**|**bit**|`1` = Column is a nonkey column added to the index by using the CREATE INDEX INCLUDE clause, or the column is part of a columnstore index.<br /><br />`0` = Column isn't an included column.<br /><br />Columns implicitly added because they're part of the clustering key aren't listed in `sys.index_columns`.<br /><br />Columns implicitly added because they're a partitioning column are returned as `0`.|
39-
|**column_store_order_ordinal**|**tinyint**|**Applies to**: [!INCLUDE[ssazuresynapse-md](../../includes/ssazuresynapse-md.md)], [!INCLUDE[sssql22-md](../../includes/sssql22-md.md)], [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)], and [!INCLUDE [ssazure-sqlmi-autd](../../includes/ssazure-sqlmi-autd.md)]<br /><br />Ordinal (1-based) within set of order columns in an ordered columnstore index. For more on ordered columnstore indexes, see [Performance tuning with ordered columnstore indexes](../indexes/ordered-columnstore-indexes.md).|
39+
|**column_store_order_ordinal**|**tinyint**|**Applies to**: [!INCLUDE[ssazuresynapse-md](../../includes/ssazuresynapse-md.md)], [!INCLUDE[sssql22-md](../../includes/sssql22-md.md)], [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)], and [!INCLUDE [ssazure-sqlmi-autd](../../includes/applies-to-version/ssazure-sqlmi-autd.md)]<br /><br />Ordinal (1-based) within set of order columns in an ordered columnstore index. For more on ordered columnstore indexes, see [Performance tuning with ordered columnstore indexes](../indexes/ordered-columnstore-indexes.md).|
4040
| `data_clustering_ordinal` | **tinyint** | 0 = Not a columnstore index & data clustering ordinal doesn't apply <br /> **Applies to**: [!INCLUDE [sssql25-md](../../includes/sssql25-md.md)] |
4141

4242
## Permissions

docs/t-sql/functions/product-aggregate-transact-sql.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Returns the product of all *expression* values in the most precise *expression*
8787

8888
## Remarks
8989

90-
Support for `PRODUCT` in [!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)] is limited to [!INCLUDE [ssazure-sqlmi-autd](../../includes/ssazure-sqlmi-autd.md)].
90+
Support for `PRODUCT` in [!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)] is limited to [!INCLUDE [ssazure-sqlmi-autd](../../includes/applies-to-version/ssazure-sqlmi-autd.md)].
9191

9292
`PRODUCT` is a deterministic function when used without the `OVER` and `ORDER BY` clauses. It's nondeterministic when specified with the `OVER` and `ORDER BY` clauses. For more information, see [Deterministic and nondeterministic functions](../../relational-databases/user-defined-functions/deterministic-and-nondeterministic-functions.md).
9393

docs/t-sql/statements/alter-database-scoped-configuration-transact-sql.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Enable several database configuration settings at the individual da
55
author: markingmyname
66
ms.author: maghan
77
ms.reviewer: derekw, bobward, jovanpop, wiassaf, mariyaali, randolphwest
8-
ms.date: 12/17/2025
8+
ms.date: 01/27/2025
99
ms.service: sql
1010
ms.subservice: t-sql
1111
ms.topic: reference
@@ -112,6 +112,8 @@ ALTER DATABASE SCOPED CONFIGURATION
112112
| PAUSED_RESUMABLE_INDEX_ABORT_DURATION_MINUTES = <time>
113113
| PREVIEW_FEATURES = { ON | OFF }
114114
| QUERY_OPTIMIZER_HOTFIXES = { ON | OFF | PRIMARY }
115+
| READABLE_SECONDARY_TEMPORARY_STATS_AUTO_CREATE = { ON | OFF | PRIMARY }
116+
| READABLE_SECONDARY_TEMPORARY_STATS_AUTO_UPDATE = { ON | OFF | PRIMARY }
115117
| ROW_MODE_MEMORY_GRANT_FEEDBACK = { ON | OFF }
116118
| TSQL_SCALAR_UDF_INLINING = { ON | OFF }
117119
| VERBOSE_TRUNCATION_WARNINGS = { ON | OFF }
@@ -513,6 +515,22 @@ This value is valid only on secondaries while the database is on the primary. It
513515

514516
For more information on `QUERY_OPTIMIZER_HOTFIXES`, see [SQL Server query optimizer hotfix trace flag 4199 servicing model](https://support.microsoft.com/help/974006).
515517

518+
#### READABLE_SECONDARY_TEMPORARY_STATS_AUTO_CREATE = { ON | OFF | PRIMARY }
519+
520+
**Applies to**: [!INCLUDE [sssql25-md](../../includes/sssql25-md.md)] and later versions, [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)], [!INCLUDE [ssazure-sqlmi-autd](../../includes/applies-to-version/ssazure-sqlmi-autd.md)], and [!INCLUDE [ssazure-sqlmi-2025](../../includes/applies-to-version/ssazure-sqlmi-2025.md)]
521+
522+
Enables or disables the automatic creation of [temporary statistics](../../relational-databases/statistics/statistics.md#temporary-statistics) for readable secondary replicas of a database and for database snapshots.
523+
524+
The default is `ON`.
525+
526+
#### READABLE_SECONDARY_TEMPORARY_STATS_AUTO_UPDATE = { ON | OFF | PRIMARY }
527+
528+
**Applies to**: [!INCLUDE [sssql25-md](../../includes/sssql25-md.md)] and later versions, [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)], [!INCLUDE [ssazure-sqlmi-autd](../../includes/applies-to-version/ssazure-sqlmi-autd.md)], and [!INCLUDE [ssazure-sqlmi-2025](../../includes/applies-to-version/ssazure-sqlmi-2025.md)]
529+
530+
Enables or disables the automatic update of [temporary statistics](../../relational-databases/statistics/statistics.md#temporary-statistics) for readable secondary replicas of a database and for database snapshots.
531+
532+
The default is `ON`.
533+
516534
#### ROW_MODE_MEMORY_GRANT_FEEDBACK = { ON | OFF }
517535

518536
**Applies to**: [!INCLUDE [sql-server-2019](../../includes/sssql19-md.md)] and later versions, [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)], and [!INCLUDE [ssazuremi](../../includes/ssazuremi-md.md)]

docs/t-sql/statements/create-columnstore-index-transact-sql.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Follow [What's new in columnstore indexes](../../relational-databases/indexes/co
4949

5050
## Syntax
5151

52-
Syntax for [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)] and [!INCLUDE [ssazure-sqlmi-autd](../../includes/ssazure-sqlmi-autd.md)]:
52+
Syntax for [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)] and [!INCLUDE [ssazure-sqlmi-autd](../../includes/applies-to-version/ssazure-sqlmi-autd.md)]:
5353

5454
```syntaxsql
5555
-- Create a clustered columnstore index on disk-based table.
@@ -149,7 +149,7 @@ Some of the options aren't available in all database engine versions. The follow
149149
| `WHERE` clause | N/A | [!INCLUDE [sssql16-md](../../includes/sssql16-md.md)] |
150150
| `ORDER` clause | [!INCLUDE [sssql16-md](../../includes/sssql16-md.md)] | [!INCLUDE [sql-server-2025](../../includes/sssql25-md.md)] |
151151

152-
All options are available in Azure SQL Database and [!INCLUDE [ssazure-sqlmi-autd](../../includes/ssazure-sqlmi-autd.md)].
152+
All options are available in Azure SQL Database and [!INCLUDE [ssazure-sqlmi-autd](../../includes/applies-to-version/ssazure-sqlmi-autd.md)].
153153

154154
For more detail on feature availability, see [What's new in columnstore indexes](../../relational-databases/indexes/columnstore-indexes-what-s-new.md#feature-summary-for-product-releases).
155155

@@ -503,7 +503,7 @@ Columns that use any of the following data types can't be included in a columnst
503503
- Can't be changed by using the `ALTER INDEX` statement. To change the nonclustered index, you must drop and re-create the columnstore index instead. You can use `ALTER INDEX` to disable and rebuild a columnstore index.
504504
- Can't be created by using the `INCLUDE` keyword.
505505
- Can't specify the `ASC` or `DESC` keywords in the list of index columns. Columnstore indexes are ordered according to the compression algorithms.
506-
- In [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)], [!INCLUDE [fabric-sqldb](../../includes/fabric-sqldb.md)], [!INCLUDE [ssazure-sqlmi-autd](../../includes/ssazure-sqlmi-autd.md)], and [!INCLUDE [sql-server-2025](../../includes/sssql25-md.md)] can be ordered by including the `ORDER` clause. For more information, see [Performance tuning with ordered columnstore indexes](../../relational-databases/indexes/ordered-columnstore-indexes.md).
506+
- In [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)], [!INCLUDE [fabric-sqldb](../../includes/fabric-sqldb.md)], [!INCLUDE [ssazure-sqlmi-autd](../../includes/applies-to-version/ssazure-sqlmi-autd.md)], and [!INCLUDE [sql-server-2025](../../includes/sssql25-md.md)] can be ordered by including the `ORDER` clause. For more information, see [Performance tuning with ordered columnstore indexes](../../relational-databases/indexes/ordered-columnstore-indexes.md).
507507
- Can't include LOB columns of type **nvarchar(max)**, **varchar(max)**, and **varbinary(max)** in nonclustered columnstore indexes. Only clustered columnstore indexes support LOB types, beginning in the [!INCLUDE [sssql17-md](../../includes/sssql17-md.md)] version, Azure SQL Database (configured at Premium tier, Standard tier (S3 and above), and all vCore offerings tiers). Prior versions don't support LOB types in clustered and nonclustered columnstore indexes.
508508
- Starting with [!INCLUDE [sssql16-md](../../includes/sssql16-md.md)], you can create a nonclustered columnstore index on an indexed view.
509509

docs/t-sql/statements/create-table-transact-sql.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ Specifies to create an index on the table. This can be a clustered index, or a n
566566

567567
Specifies to store the entire table in columnar format with a clustered columnstore index. This always includes all columns in the table. The data isn't sorted in alphabetical or numeric order since the rows are organized to gain columnstore compression benefits.
568568

569-
You can specify an order for the data in a clustered columnstore index starting with [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)], in [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)], in [!INCLUDE [ssazure-sqlmi-autd](../../includes/ssazure-sqlmi-autd.md)], and in [!INCLUDE [ssazuresynapse-md](../../includes/ssazuresynapse-md.md)]. For more information, see [Performance tuning with ordered columnstore indexes](../../relational-databases/indexes/ordered-columnstore-indexes.md).
569+
You can specify an order for the data in a clustered columnstore index starting with [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)], in [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)], in [!INCLUDE [ssazure-sqlmi-autd](../../includes/applies-to-version/ssazure-sqlmi-autd.md)], and in [!INCLUDE [ssazuresynapse-md](../../includes/ssazuresynapse-md.md)]. For more information, see [Performance tuning with ordered columnstore indexes](../../relational-databases/indexes/ordered-columnstore-indexes.md).
570570

571571
#### INDEX *index_name* [ NONCLUSTERED ] COLUMNSTORE ( *column_name* [ ,... *n* ] )
572572

@@ -576,7 +576,7 @@ Specifies to create a nonclustered columnstore index on the table. The underlyin
576576

577577
The nonclustered columnstore index is stored and managed as a clustered columnstore index. It's called a nonclustered columnstore index to because the columns can be limited and it exists as a secondary index on a table.
578578

579-
You can specify an order for the data in a nonclustered columnstore index in [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)] and in [!INCLUDE [ssazure-sqlmi-autd](../../includes/ssazure-sqlmi-autd.md)]. For more information, see [Performance tuning with ordered columnstore indexes](../../relational-databases/indexes/ordered-columnstore-indexes.md).
579+
You can specify an order for the data in a nonclustered columnstore index in [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)] and in [!INCLUDE [ssazure-sqlmi-autd](../../includes/applies-to-version/ssazure-sqlmi-autd.md)]. For more information, see [Performance tuning with ordered columnstore indexes](../../relational-databases/indexes/ordered-columnstore-indexes.md).
580580

581581
#### ON *partition_scheme_name* ( *column_name* )
582582

0 commit comments

Comments
 (0)