Skip to content

Commit 152f82b

Browse files
authored
Merge pull request #4457 from pmasl/patch-99
Update update-statistics-transact-sql.md
2 parents 6fc3e59 + bf87a5a commit 152f82b

1 file changed

Lines changed: 28 additions & 10 deletions

File tree

docs/t-sql/statements/update-statistics-transact-sql.md

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "UPDATE STATISTICS (Transact-SQL) | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/20/2017"
4+
ms.date: "01/04/2018"
55
ms.prod: "sql-non-specified"
66
ms.prod_service: "database-engine, sql-database, sql-data-warehouse, pdw"
77
ms.service: ""
@@ -62,7 +62,8 @@ UPDATE STATISTICS table_or_indexed_view_name
6262
]
6363
[ [ , ] [ ALL | COLUMNS | INDEX ]
6464
[ [ , ] NORECOMPUTE ]
65-
[ [ , ] INCREMENTAL = { ON | OFF } ]
65+
[ [ , ] INCREMENTAL = { ON | OFF } ]
66+
[ [ , ] MAXDOP = max_degree_of_parallelism ]
6667
] ;
6768
6869
<update_stats_stream_option> ::=
@@ -154,29 +155,46 @@ When **ON**, the statistics will retain the set sampling percentage for subseque
154155
If per partition statistics are not supported an error is generated. Incremental stats are not supported for following statistics types:
155156

156157
- Statistics created with indexes that are not partition-aligned with the base table.
157-
158158
- Statistics created on Always On readable secondary databases.
159-
160159
- Statistics created on read-only databases.
161-
162160
- Statistics created on filtered indexes.
163-
164161
- Statistics created on views.
165-
166162
- Statistics created on internal tables.
167-
168163
- Statistics created with spatial indexes or XML indexes.
169164

170165
**Applies to**: [!INCLUDE[ssSQL14](../../includes/sssql14-md.md)] through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)]
166+
167+
MAXDOP = *max_degree_of_parallelism*
168+
**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] (Starting with [!INCLUDE[ssSQL17](../../includes/sssql17-md.md)] CU3).
169+
170+
Overrides the **max degree of parallelism** configuration option for the duration of the statistic operation. For more information, see [Configure the max degree of parallelism Server Configuration Option](../../database-engine/configure-windows/configure-the-max-degree-of-parallelism-server-configuration-option.md). Use MAXDOP to limit the number of processors used in a parallel plan execution. The maximum is 64 processors.
171+
172+
*max_degree_of_parallelism* can be:
171173

174+
1
175+
Suppresses parallel plan generation.
176+
177+
\>1
178+
Restricts the maximum number of processors used in a parallel statistic operation to the specified number or fewer based on the current system workload.
179+
180+
0 (default)
181+
Uses the actual number of processors or fewer based on the current system workload.
182+
183+
> [!NOTE]
184+
> Parallel statistics operations are not available in every edition of [!INCLUDE[msCoName](../../includes/msconame-md.md)][!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]. For a list of features that are supported by the editions of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)], see [Editions and Supported Features for SQL Server 2016](../../sql-server/editions-and-supported-features-for-sql-server-2016.md) and [Editions and Supported Features for SQL Server 2017](../../sql-server/editions-and-components-of-sql-server-2017.md).
185+
172186
\<update_stats_stream_option>
173187
[!INCLUDE[ssInternalOnly](../../includes/ssinternalonly-md.md)]
174-
188+
175189
## Remarks
176190

177191
## When to Use UPDATE STATISTICS
178192
For more information about when to use UPDATE STATISTICS, see [Statistics](../../relational-databases/statistics/statistics.md).
179-
193+
194+
## Limitations and Restrictions
195+
* Updating statistics is not supported on external tables. To update statistics on an external table, drop and re-create the statistics.
196+
* The MAXDOP option is not compatible with STATS_STREAM, ROWCOUNT and PAGECOUNT options.
197+
180198
## Updating All Statistics with sp_updatestats
181199
For information about how to update statistics for all user-defined and internal tables in the database, see the stored procedure [sp_updatestats &#40;Transact-SQL&#41;](../../relational-databases/system-stored-procedures/sp-updatestats-transact-sql.md). For example, the following command calls sp_updatestats to update all statistics for the database.
182200

0 commit comments

Comments
 (0)