You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -139,15 +138,15 @@ FROM t WITH (TABLOCK, INDEX(myindex))
139
138
We recommend using commas between table hints.
140
139
141
140
> [!IMPORTANT]
142
-
> Separating hints by spaces rather than commas is a deprecated feature: [!INCLUDE[ssNoteDepFutureDontUse](../../includes/ssnotedepfuturedontuse-md.md)]
141
+
> Separating hints by spaces rather than commas is a deprecated feature: [!INCLUDE[ssNoteDepFutureDontUse](../../includes/ssnotedepfuturedontuse-md.md)]
143
142
144
143
NOEXPAND
145
144
Specifies that any indexed views are not expanded to access underlying tables when the query optimizer processes the query. The query optimizer treats the view like a table with clustered index. NOEXPAND applies only to indexed views. For more information, see [Using NOEXPAND](#using-noexpand).
146
145
147
-
INDEX **(**_index\_value_[**,**... _n_] ) | INDEX = ( _index\_value_**)**
148
-
The INDEX() syntax specifies the names or IDs of one or more indexes to be used by the query optimizer when it processes the statement. The alternative INDEX = syntax specifies a single index value. Only one index hint per table can be specified.
146
+
INDEX **(**_<index\_value>_[**,**... _n_] ) | INDEX = ( _<index\_value>_**)**
147
+
The INDEX() syntax specifies the names or IDs of one or more indexes to be used by the query optimizer when it processes the statement. The alternative `INDEX =` syntax specifies a single index value. Only one index hint per table can be specified.
149
148
150
-
If a clustered index exists, INDEX(0) forces a clustered index scan and INDEX(1) forces a clustered index scan or seek. If no clustered index exists, INDEX(0) forces a table scan and INDEX(1) is interpreted as an error.
149
+
If a clustered index exists, `INDEX(0)` forces a clustered index scan and `INDEX(1)` forces a clustered index scan or seek. If no clustered index exists, `INDEX(0)` forces a table scan and `INDEX(1)` is interpreted as an error.
151
150
152
151
If multiple indexes are used in a single hint list, the duplicates are ignored and the rest of the listed indexes are used to retrieve the rows of the table. The order of the indexes in the index hint is significant. A multiple index hint also enforces index ANDing, and the query optimizer applies as many conditions as possible on each index accessed. If the collection of hinted indexes do not include all columns referenced by the query, a fetch is performed to retrieve the remaining columns after the [!INCLUDE[ssDEnoversion](../../includes/ssdenoversion-md.md)] retrieves all the indexed columns.
153
152
@@ -175,7 +174,7 @@ Specifies insertion of a table column's default value, if any, instead of NULL w
175
174
176
175
For an example that uses this hint in an INSERT ... SELECT * FROM OPENROWSET(BULK...) statement, see [Keep Nulls or Use Default Values During Bulk Import (SQL Server)](../../relational-databases/import-export/keep-nulls-or-use-default-values-during-bulk-import-sql-server.md).
Specifies that the query optimizer use only an index seek operation as the access path to the data in the table or view.
180
179
181
180
> [!NOTE]
@@ -229,7 +228,7 @@ For partitioned tables and indexes, FORCESCAN is applied after partitions have b
229
228
The FORCESCAN hint has the following restrictions:
230
229
- The hint cannot be specified for a table that is the target of an INSERT, UPDATE, or DELETE statement.
231
230
- The hint cannot be used with more than one index hint.
232
-
- The hint prevents the optimizer from considering any spatial or XML indexes on the table.
231
+
- The hint prevents the Query Optimizer from considering any spatial or XML indexes on the table.
233
232
- The hint cannot be specified for a remote data source.
234
233
- The hint cannot be specified in combination with the FORCESEEK hint.
235
234
@@ -326,9 +325,9 @@ LEFT JOIN dbo.[Order History] AS oh
326
325
ONc.customer_id=oh.customer_id;
327
326
```
328
327
329
-
SPATIAL_WINDOW_MAX_CELLS = *integer*
328
+
SPATIAL_WINDOW_MAX_CELLS = *<integer\_value>*
330
329
**Applies to**: [!INCLUDE[ssSQL11](../../includes/sssql11-md.md)] and later.
331
-
Specifies the maximum number of cells to use for tessellating a geometry or geography object. *number* is a value between 1 and 8192.
330
+
Specifies the maximum number of cells to use for tessellating a geometry or geography object. *<integer\_value>* is a value between 1 and 8192.
332
331
333
332
This option allows for fine-tuning of query execution time by adjusting the tradeoff between primary and secondary filter execution time. A larger number reduces secondary filter execution time, but increases primary execution filter time and a smaller number decreases primary filter execution time, but increase secondary filter execution. For denser spatial data, a higher number should produce a faster execution time by giving a better approximation with the primary filter and reducing secondary filter execution time. For sparser data, a lower number will decrease the primary filter execution time.
334
333
@@ -385,12 +384,12 @@ SELECT StartDate, ComponentID FROM Production.BillOfMaterials
385
384
GO
386
385
```
387
386
388
-
The query optimizer will not consider an index hint if the SET options do not have the required values for filtered indexes. For more information, see [CREATE INDEX (Transact-SQL)](../../t-sql/statements/create-index-transact-sql.md).
387
+
The Query Optimizer will not consider an index hint if the SET options do not have the required values for filtered indexes. For more information, see [CREATE INDEX (Transact-SQL)](../../t-sql/statements/create-index-transact-sql.md).
389
388
390
389
## Using NOEXPAND
391
-
NOEXPAND applies only to *indexed views*. An indexed view is a view with a unique clustered index created on it. If a query contains references to columns that are present both in an indexed view and base tables, and the query optimizer determines that using the indexed view provides the best method for executing the query, the query optimizer uses the index on the view. This functionality is called *indexed view matching*. Prior to [!INCLUDE[ssSQL15_md](../../includes/sssql15-md.md)] SP1, automatic use of an indexed view by the query optimizer is supported only in specific editions of [!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 [Features Supported by the Editions of SQL Server 2016](../../sql-server/editions-and-supported-features-for-sql-server-2016.md).
390
+
NOEXPAND applies only to *indexed views*. An indexed view is a view with a unique clustered index created on it. If a query contains references to columns that are present both in an indexed view and base tables, and the query optimizer determines that using the indexed view provides the best method for executing the query, the query optimizer uses the index on the view. This functionality is called *indexed view matching*. Prior to [!INCLUDE[ssSQL15_md](../../includes/sssql15-md.md)] SP1, automatic use of an indexed view by the Query Optimizer is supported only in specific editions of [!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 [Features Supported by the Editions of SQL Server 2016](../../sql-server/editions-and-supported-features-for-sql-server-2016.md), [Features Supported by the Editions of SQL Server 2017](../../SQL-server/editions-and-components-of-SQL-server-2017.md), and [Features Supported by the Editions of SQL Server 2019](../../sql-server/editions-and-components-of-sql-server-version-15.md).
392
391
393
-
However, for the optimizer to consider indexed views for matching, or use an indexed view that is referenced with the NOEXPAND hint, the following SET options must be set to ON.
392
+
However, for the Query Optimizer to consider indexed views for matching, or use an indexed view that is referenced with the NOEXPAND hint, the following SET options must be set to ON.
394
393
395
394
> [!NOTE]
396
395
> [!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)] supports automatic use of indexed views without specifying the NOEXPAND hint.
@@ -406,14 +405,14 @@ However, for the optimizer to consider indexed views for matching, or use an ind
406
405
407
406
Also, the NUMERIC_ROUNDABORT option must be set to OFF.
408
407
409
-
To force the optimizer to use an index for an indexed view, specify the NOEXPAND option. This hint can be used only if the view is also named in the query. [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] does not provide a hint to force a particular indexed view to be used in a query that does not name the view directly in the FROM clause; however, the query optimizer considers using indexed views, even if they are not referenced directly in the query. SQL Server will only automatically create statistics on an indexed view when a NOEXPAND table hint is used. Omitting this hint can lead to execution plan warnings about missing statistics that cannot be resolved by creating statistics manually.
410
-
During query optimization[!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] will use view statistics that were created automatically or manually when the query references the view directly and the NOEXPAND hint is used.
408
+
To force the Query Optimizer to use an index for an indexed view, specify the NOEXPAND option. This hint can be used only if the view is also named in the query. [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] does not provide a hint to force a particular indexed view to be used in a query that does not name the view directly in the FROM clause; however, the Query Optimizer considers using indexed views, even if they are not referenced directly in the query. The [!INCLUDE[ssDEnoversion](../../includes/ssdenoversion-md.md)] will only automatically create statistics on an indexed view when a NOEXPAND table hint is used. Omitting this hint can lead to execution plan warnings about missing statistics that cannot be resolved by creating statistics manually.
409
+
During query optimization, the [!INCLUDE[ssde_md](../../includes/ssde_md.md)] will use view statistics that were created automatically or manually when the query references the view directly and the NOEXPAND hint is used.
411
410
412
411
## Using a Table Hint as a Query Hint
413
412
*Table hints* can also be specified as a query hint by using the OPTION (TABLE HINT) clause. We recommend using a table hint as a query hint only in the context of a [plan guide](../../relational-databases/performance/plan-guides.md). For ad-hoc queries, specify these hints only as table hints. For more information, see [Query Hints (Transact-SQL)](../../t-sql/queries/hints-transact-sql-query.md).
414
413
415
414
## Permissions
416
-
The KEEPIDENTITY, IGNORE_CONSTRAINTS, and IGNORE_TRIGGERS hints require ALTER permissions on the table.
415
+
The KEEPIDENTITY, IGNORE_CONSTRAINTS, and IGNORE_TRIGGERS hints require `ALTER` permissions on the table.
0 commit comments