Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit 11f5ae6

Browse files
authored
Merge pull request #3162 from pmasl/patch-56
Update alter-database-scoped-configuration-transact-sql.md
2 parents 8fbdefa + 3283cea commit 11f5ae6

1 file changed

Lines changed: 32 additions & 23 deletions

File tree

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

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ manager: "jhubbard"
3838

3939
- Set the query optimizer cardinality estimation model independent of the database to compatibility level.
4040

41-
- Enable or disable parameter sniffing at the database level.
41+
- Enable or disable parameter sniffing at the database level.
4242

43-
- Enable or disable query optimization hotfixes at the database level.
43+
- Enable or disable query optimization hotfixes at the database level.
4444

45-
- Enable or disable the identity cache at the database level.
45+
- Enable or disable the identity cache at the database level.
4646

4747
![Topic link icon](../../database-engine/configure-windows/media/topic-link.gif "Topic link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
4848

@@ -81,37 +81,50 @@ Specifies the default MAXDOP setting that should be used for statements. 0 is th
8181

8282
You can use the max degree of parallelism option to limit the number of processors to use in parallel plan execution. SQL Server considers parallel execution plans for queries, index data definition language (DDL) operations, parallel insert, online alter column, parallel stats collectiion, and static and keyset-driven cursor population.
8383

84-
To set this option at the instance level, see [Configure the max degree of parallelism Server Configuration Option](../../database-engine/configure-windows/configure-the-max-degree-of-parallelism-server-configuration-option.md). To accomplish this at the query level, add the **QUERYTRACEON** [query hint](https://msdn.microsoft.com/library/ms181714.aspx)
84+
To set this option at the instance level, see [Configure the max degree of parallelism Server Configuration Option](../../database-engine/configure-windows/configure-the-max-degree-of-parallelism-server-configuration-option.md).
85+
86+
> [!TIP]
87+
> To accomplish this at the query level, add the **MAXDOP** [query hint](../../t-sql/queries/hints-transact-sql-query.md).
8588
8689
PRIMARY
8790

88-
Can only be set for the secondaries and indicates that the configuration will be the one set for the primary. If the configuration for the primary changes, secondary will also adjust to the same value. **PRIMARY** is the default setting for the secondaries
91+
Can only be set for the secondaries, while the database in on the primary, and indicates that the configuration will be the one set for the primary. If the configuration for the primary changes, the value on the secondaries will change accordingly without the need to set the secondaries value explicitely. **PRIMARY** is the default setting for the secondaries.
8992

9093
LEGACY_CARDINALITY_ESTIMATION **=** { ON | **OFF** | PRIMARY }
9194

92-
Enables you to set the query optimizer cardinality estimation model to the SQL Server 2012 and earlier version independent of the compatibility level of the database. The default is **OFF**, which sets the query optimizer cardinality estimation model based on the compatibility level of the database. Setting this to **ON** is equivalent to [Trace Flag 9481](https://support.microsoft.com/en-us/kb/2801413). To set this at the instance level, see [Trace Flags (Transact-SQL)](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md). To accomplish this at the query level, add the **QUERYTRACEON** [query hint](https://msdn.microsoft.com/library/ms181714.aspx).
95+
Enables you to set the query optimizer cardinality estimation model to the SQL Server 2012 and earlier version independent of the compatibility level of the database. The default is **OFF**, which sets the query optimizer cardinality estimation model based on the compatibility level of the database. Setting this to **ON** is equivalent to enabling [Trace Flag 9481](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md).
96+
97+
> [!TIP]
98+
> To accomplish this at the query level, add the **QUERYTRACEON** [query hint](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md).
99+
> Starting with [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)] SP1, to accomplish this at the query level, add the **USE HINT** [query hint](../../t-sql/queries/hints-transact-sql-query.md) instead of using the trace flag.
93100
94101
PRIMARY
95102

96-
This value is only valid on secondaries and specifies that the query optimizer cardinality estimation model setting on all secondaries will be the value set for the primary. If the configuration on the primary for the query optimizer cardinality estimation model changes, the value on the secondaries will change accordingly. **PRIMARY** is the default setting for the secondaries.
103+
This value is only valid on secondaries while the database in on the primary, and specifies that the query optimizer cardinality estimation model setting on all secondaries will be the value set for the primary. If the configuration on the primary for the query optimizer cardinality estimation model changes, the value on the secondaries will change accordingly. **PRIMARY** is the default setting for the secondaries.
97104

98105
PARAMETER_SNIFFING **=** { **ON** | OFF | PRIMARY}
99106

100-
Enables or disables parameter sniffing. The default is ON. This is equivalent to [Trace Flag 4136](https://support.microsoft.com/en-us/kb/980653). To set this at the instance level, see [Trace Flags (Transact-SQL)](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md). To set this at the query level, see the **OPTIMIZE FOR UNKNOWN** [query hint](https://msdn.microsoft.com/library/ms181714.aspx).
107+
Enables or disables [parameter sniffing](../../relational-databases/query-processing-architecture-guide.md#ParamSniffing). The default is ON. This is equivalent to [Trace Flag 4136](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md).
108+
109+
> [!TIP]
110+
> To accomplish this at the query level, see the **OPTIMIZE FOR UNKNOWN** [query hint](../../t-sql/queries/hints-transact-sql-query.md).
111+
> Starting with [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)] SP1, to accomplish this at the query level, the **USE HINT** [query hint](../../t-sql/queries/hints-transact-sql-query.md) is also available.
101112
102113
PRIMARY
103114

104-
This value is only valid on secondaries and specifies that the value for this setting on all secondaries will be the vale set for the primary. If the configuration for the primary changes, the value on the secondaries will change accordingly. This is the default setting for the secondaries.
115+
This value is only valid on secondaries while the database in on the primary, and specifies that the value for this setting on all secondaries will be the value set for the primary. If the configuration on the primary for using [parameter sniffing](../../relational-databases/query-processing-architecture-guide.md#ParamSniffing) changes, the value on the secondaries will change accordingly without the need to set the secondaries value explicitely. This is the default setting for the secondaries.
105116

106117
QUERY_OPTIMIZER_HOTFIXES **=** { ON | **OFF** | PRIMARY }
107118

108-
Enables or disables query optimization hotfixes regardless of the compatibility level of the database. The default is **OFF**. This is equivalent to [Trace Flag 4199](https://support.microsoft.com/en-us/kb/974006).
119+
Enables or disables query optimization hotfixes regardless of the compatibility level of the database. The default is **OFF**. This is equivalent to enabling [Trace Flag 4199](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md).
109120

110-
To set this at the instance level, see [Trace Flags (Transact-SQL)](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md). To accomplish this at the query level, add the **QUERYTRACEON** [query hint](https://msdn.microsoft.com/library/ms181714.aspx).
121+
> [!TIP]
122+
> To accomplish this at the query level, add the **QUERYTRACEON** [query hint](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md).
123+
> Starting with [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)] SP1, to accomplish this at the query level, add the USE HINT [query hint](../../t-sql/queries/hints-transact-sql-query.md) instead of using the trace flag.
111124
112125
PRIMARY
113126

114-
This value is only valid on secondaries and specifies that the value for this setting on all secondaries will be the vale set for the primary. If the configuration for the primary changes, the value on the secondaries will change accordingly. This is the default setting for the secondaries.
127+
This value is only valid on secondaries while the database in on the primary, and specifies that the value for this setting on all secondaries will be the value set for the primary. If the configuration for the primary changes, the value on the secondaries will change accordingly without the need to set the secondaries value explicitely. This is the default setting for the secondaries.
115128

116129
CLEAR PROCEDURE_CACHE
117130

@@ -165,7 +178,7 @@ on the database. This permission can be granted by a user with CONTROL permissio
165178

166179
**DacFx**
167180

168-
Since ALTER DATABASE SCOPED CONFIGURATION is a new feature in Azure SQL Database and SQL Server 2016 that affects the database schema, exports of the schema (with or without data) will not be able to be imported into an older version of SQL Server e.g. SQL Server 2012 or SQL Server 2014. For example, an export to a [DACPAC](https://msdn.microsoft.com/library/ee210546.aspx#Anchor_3) or a [BACPAC](https://msdn.microsoft.com/library/ee210546.aspx#Anchor_4) from an Azure SQL Database or SQL Server 2016 database that used this new feature would not be able to be imported into a down-level server.
181+
Since ALTER DATABASE SCOPED CONFIGURATION is a new feature in Azure SQL Database and SQL Server 2016 that affects the database schema, exports of the schema (with or without data) will not be able to be imported into an older version of SQL Server e.g. [!INCLUDE[ssSQL11](../../includes/sssql11-md.md)] or [!INCLUDE[ssSQLv14](../../includes/sssqlv14-md.md)]. For example, an export to a [DACPAC](https://msdn.microsoft.com/library/ee210546.aspx#Anchor_3) or a [BACPAC](https://msdn.microsoft.com/library/ee210546.aspx#Anchor_4) from an [!INCLUDE[ssSDS](../../includes/sssds-md.md)] or [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)] database that used this new feature would not be able to be imported into a down-level server.
169182

170183
## Metadata
171184

@@ -192,26 +205,24 @@ ALTER DATABASE SCOPED CONFIGURATION SET MAXDOP = 1 ;
192205
ALTER DATABASE SCOPED CONFIGURATION FOR SECONDARY SET MAXDOP=4 ;
193206
```
194207

195-
This example sets MAXDOP for a secondary database as it is for its primary database in a geo-replication scenario.
208+
This example sets MAXDOP for a secondary database to be the same as it is set for its primary database in a geo-replication scenario.
196209

197210
```tsql
198-
ALTER DATABASE SCOPED CONFIGURATION FOR SECONDARY SET MAXDOP=PRIMARY
211+
ALTER DATABASE SCOPED CONFIGURATION FOR SECONDARY SET MAXDOP=PRIMARY ;
199212
```
200213

201214
### C. Set LEGACY_CARDINALITY_ESTIMATION
202215

203216
This example sets LEGACY_CARDINALITY_ESTIMATION to ON for a secondary database in a geo-replication scenario.
204217

205218
```tsql
206-
ALTER DATABASE SCOPED CONFIGURATION FOR SECONDARY
207-
SET LEGACY_CARDINALITY_ESTIMATION=ON ;
219+
ALTER DATABASE SCOPED CONFIGURATION FOR SECONDARY SET LEGACY_CARDINALITY_ESTIMATION=ON ;
208220
```
209221

210222
This example sets LEGACY_CARDINALITY_ESTIMATION for a secondary database as it is for its primary database in a geo-replication scenario.
211223

212224
```tsql
213-
ALTER DATABASE SCOPED CONFIGURATION FOR SECONDARY
214-
SET LEGACY_CARDINALITY_ESTIMATION=PRIMARY ;
225+
ALTER DATABASE SCOPED CONFIGURATION FOR SECONDARY SET LEGACY_CARDINALITY_ESTIMATION=PRIMARY ;
215226
```
216227

217228
### D. Set PARAMETER_SNIFFING
@@ -225,16 +236,14 @@ ALTER DATABASE SCOPED CONFIGURATION SET PARAMETER_SNIFFING =OFF ;
225236
This example sets PARAMETER_SNIFFING to OFF for a primary database in a geo-replication scenario.
226237

227238
```tsql
228-
ALTER DATABASE SCOPED CONFIGURATION FOR SECONDARY
229-
SET PARAMETER_SNIFFING=OFF ;
239+
ALTER DATABASE SCOPED CONFIGURATION FOR SECONDARY SET PARAMETER_SNIFFING=OFF ;
230240
```
231241

232242
This example sets PARAMETER_SNIFFING for secondary database as it is on primary database
233243
in a geo-replication scenario.
234244

235245
```tsql
236-
ALTER DATABASE SCOPED CONFIGURATION FOR SECONDARY
237-
SET PARAMETER_SNIFFING =PRIMARY ;
246+
ALTER DATABASE SCOPED CONFIGURATION FOR SECONDARY SET PARAMETER_SNIFFING =PRIMARY ;
238247
```
239248

240249
### E. Set QUERY_OPTIMIZER_HOTFIXES

0 commit comments

Comments
 (0)