|
1 | 1 | --- |
2 | 2 | title: "UPDATE STATISTICS (Transact-SQL) | Microsoft Docs" |
3 | 3 | ms.custom: "" |
4 | | -ms.date: "11/20/2017" |
| 4 | +ms.date: "01/04/2018" |
5 | 5 | ms.prod: "sql-non-specified" |
6 | 6 | ms.prod_service: "database-engine, sql-database, sql-data-warehouse, pdw" |
7 | 7 | ms.service: "" |
@@ -62,7 +62,8 @@ UPDATE STATISTICS table_or_indexed_view_name |
62 | 62 | ] |
63 | 63 | [ [ , ] [ ALL | COLUMNS | INDEX ] |
64 | 64 | [ [ , ] NORECOMPUTE ] |
65 | | - [ [ , ] INCREMENTAL = { ON | OFF } ] |
| 65 | + [ [ , ] INCREMENTAL = { ON | OFF } ] |
| 66 | + [ [ , ] MAXDOP = max_degree_of_parallelism ] |
66 | 67 | ] ; |
67 | 68 | |
68 | 69 | <update_stats_stream_option> ::= |
@@ -154,29 +155,46 @@ When **ON**, the statistics will retain the set sampling percentage for subseque |
154 | 155 | If per partition statistics are not supported an error is generated. Incremental stats are not supported for following statistics types: |
155 | 156 |
|
156 | 157 | - Statistics created with indexes that are not partition-aligned with the base table. |
157 | | - |
158 | 158 | - Statistics created on Always On readable secondary databases. |
159 | | - |
160 | 159 | - Statistics created on read-only databases. |
161 | | - |
162 | 160 | - Statistics created on filtered indexes. |
163 | | - |
164 | 161 | - Statistics created on views. |
165 | | - |
166 | 162 | - Statistics created on internal tables. |
167 | | - |
168 | 163 | - Statistics created with spatial indexes or XML indexes. |
169 | 164 |
|
170 | 165 | **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: |
171 | 173 |
|
| 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 | +
|
172 | 186 | \<update_stats_stream_option> |
173 | 187 | [!INCLUDE[ssInternalOnly](../../includes/ssinternalonly-md.md)] |
174 | | - |
| 188 | + |
175 | 189 | ## Remarks |
176 | 190 |
|
177 | 191 | ## When to Use UPDATE STATISTICS |
178 | 192 | 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 | + |
180 | 198 | ## Updating All Statistics with sp_updatestats |
181 | 199 | For information about how to update statistics for all user-defined and internal tables in the database, see the stored procedure [sp_updatestats (Transact-SQL)](../../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. |
182 | 200 |
|
|
0 commit comments