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
Copy file name to clipboardExpand all lines: docs/relational-databases/query-processing-architecture-guide.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: "How SQL Server processes queries and optimizes query reuse through
4
4
author: MikeRayMSFT
5
5
ms.author: mikeray
6
6
ms.reviewer: maghan, randolphwest, derekw
7
-
ms.date: 01/16/2024
7
+
ms.date: 01/14/2025
8
8
ms.service: sql
9
9
ms.topic: conceptual
10
10
helpviewer_keywords:
@@ -348,7 +348,7 @@ The join order in the query plan is `Table1`, `Table2`, `TableA`, `TableB`, `Tab
348
348
349
349
As with any index, [!INCLUDE [ssNoVersion](../includes/ssnoversion-md.md)] chooses to use an indexed view in its query plan only if the Query Optimizer determines it is beneficial to do so.
350
350
351
-
Indexed views can be created in any edition of [!INCLUDE [ssNoVersion](../includes/ssnoversion-md.md)]. In some editions of some older versions of [!INCLUDE [ssNoVersion](../includes/ssnoversion-md.md)], the Query Optimizer automatically considers the indexed view. In some editions of some older versions of [!INCLUDE [ssNoVersion](../includes/ssnoversion-md.md)], to use an indexed view, the `NOEXPAND` table hint must be used. Prior to [!INCLUDE [ssSQL15_md](../includes/sssql16-md.md)] Service Pack 1, automatic use of an indexed view by the query optimizer is supported only in specific editions of [!INCLUDE [ssNoVersion](../includes/ssnoversion-md.md)]. Since, all editions support automatic use of an indexed view. [!INCLUDE [ssazure-sqldb](../includes/ssazure-sqldb.md)] and [!INCLUDE [ssazuremi-md](../includes/ssazuremi-md.md)] also support automatic use of indexed views without specifying the `NOEXPAND` hint.
351
+
Indexed views can be created in any edition of [!INCLUDE [ssNoVersion](../includes/ssnoversion-md.md)]. In some editions of some older versions of [!INCLUDE [ssNoVersion](../includes/ssnoversion-md.md)], the Query Optimizer automatically considers the indexed view. In some editions of some older versions of [!INCLUDE [ssNoVersion](../includes/ssnoversion-md.md)], to use an indexed view, the `NOEXPAND` table hint must be used. Automatic use of an indexed view by the query optimizer is supported only in specific editions of [!INCLUDE [ssNoVersion](../includes/ssnoversion-md.md)]. [!INCLUDE [ssazure-sqldb](../includes/ssazure-sqldb.md)] and [!INCLUDE [ssazuremi-md](../includes/ssazuremi-md.md)] also support automatic use of indexed views without specifying the `NOEXPAND` hint.
352
352
353
353
The [!INCLUDE [ssNoVersion](../includes/ssnoversion-md.md)] Query Optimizer uses an indexed view when the following conditions are met:
354
354
@@ -384,7 +384,7 @@ You can prevent view indexes from being used for a query by using the `EXPAND VI
384
384
385
385
- The `EXPAND VIEWS` option specifies that the Query Optimizer not use any view indexes for the whole query.
386
386
387
-
- When `NOEXPAND` is specified for a view, the Query Optimizer considers using any indexes defined on the view. `NOEXPAND` specified with the optional `INDEX()` clause forces the Query Optimizer to use the specified indexes. `NOEXPAND` can be specified only for an indexed view and can't be specified for a view not indexed. Prior to [!INCLUDE [ssSQL15_md](../includes/sssql16-md.md)] Service Pack 1, automatic use of an indexed view by the query optimizer is supported only in specific editions of [!INCLUDE [ssNoVersion](../includes/ssnoversion-md.md)]. Since, all editions support automatic use of an indexed view. [!INCLUDE [ssazure-sqldb](../includes/ssazure-sqldb.md)] and [!INCLUDE [ssazuremi-md](../includes/ssazuremi-md.md)] also support automatic use of indexed views without specifying the `NOEXPAND` hint.
387
+
- When `NOEXPAND` is specified for a view, the Query Optimizer considers using any indexes defined on the view. `NOEXPAND` specified with the optional `INDEX()` clause forces the Query Optimizer to use the specified indexes. `NOEXPAND` can be specified only for an indexed view and can't be specified for a view not indexed. Automatic use of an indexed view by the query optimizer is supported only in specific editions of [!INCLUDE [ssNoVersion](../includes/ssnoversion-md.md)]. [!INCLUDE [ssazure-sqldb](../includes/ssazure-sqldb.md)] and [!INCLUDE [ssazuremi-md](../includes/ssazuremi-md.md)] also support automatic use of indexed views without specifying the `NOEXPAND` hint.
388
388
389
389
When neither `NOEXPAND` nor `EXPAND VIEWS` is specified in a query that contains a view, the view is expanded to access underlying tables. If the query that makes up the view contains any table hints, these hints are propagated to the underlying tables. (This process is explained in more detail in View Resolution.) As long as the set of hints that exists on the underlying tables of the view are identical to each other, the query is eligible to be matched with an indexed view. Most of the time, these hints will match each other, because they are being inherited directly from the view. However, if the query references tables instead of views, and the hints applied directly on these tables aren't identical, then such a query isn't eligible for matching with an indexed view. If the `INDEX`, `PAGLOCK`, `ROWLOCK`, `TABLOCKX`, `UPDLOCK`, or `XLOCK` hints apply to the tables referenced in the query after view expansion, the query isn't eligible for indexed view matching.
390
390
@@ -1582,7 +1582,7 @@ GO
1582
1582
1583
1583
## Related content
1584
1584
1585
-
-[Showplan Logical and Physical Operators Reference](showplan-logical-and-physical-operators-reference.md)
1585
+
-[Logical and physical showplan operator reference](showplan-logical-and-physical-operators-reference.md)
Copy file name to clipboardExpand all lines: docs/relational-databases/views/create-indexed-views.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
1
---
2
-
title: Create indexed views
2
+
title: Create Indexed Views
3
3
description: Creating a unique clustered index on a view improves query performance, because the view is stored in the same way as a clustered index is stored.
4
4
author: WilliamDAssafMSFT
5
5
ms.author: wiassaf
6
6
ms.reviewer: randolphwest
7
-
ms.date: 07/22/2024
7
+
ms.date: 01/14/2025
8
8
ms.service: sql
9
9
ms.subservice: table-view-index
10
10
ms.topic: conceptual
@@ -252,7 +252,7 @@ GROUP BY OrderDate
252
252
ORDER BY OrderDate ASC;
253
253
```
254
254
255
-
Finally, this example shows querying directly from the indexed view. Before [!INCLUDE [ssSQL15_md](../../includes/sssql16-md.md)] Service Pack 1, automatic use of an indexed view by the query optimizer is supported only in specific editions of [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)]. On [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] Standard edition, you must use the `NOEXPAND` query hint to query the indexed view directly. Since [!INCLUDE [ssSQL15_md](../../includes/sssql16-md.md)] Service Pack 1, all editions support automatic use of an indexed view. [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)] and [!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)] also support automatic use of indexed views without specifying the `NOEXPAND` hint. For more information, see [Table Hints (Transact-SQL)](../../t-sql/queries/hints-transact-sql-table.md#using-noexpand).
255
+
Finally, this example shows querying directly from the indexed view. Automatic use of an indexed view by the query optimizer is supported only in specific editions of [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)]. On [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] Standard edition, you must use the `NOEXPAND` query hint to query the indexed view directly. [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)] and [!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)] support automatic use of indexed views without specifying the `NOEXPAND` hint. For more information, see [Table Hints (Transact-SQL)](../../t-sql/queries/hints-transact-sql-table.md#using-noexpand).
256
256
257
257
```sql
258
258
--This query uses the indexed view directly, on Enterprise edition.
Copy file name to clipboardExpand all lines: docs/t-sql/queries/hints-transact-sql-table.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: Table hints override the default behavior of the query optimizer du
4
4
author: VanMSFT
5
5
ms.author: vanto
6
6
ms.reviewer: randolphwest
7
-
ms.date: 12/16/2024
7
+
ms.date: 01/14/2025
8
8
ms.service: sql
9
9
ms.subservice: t-sql
10
10
ms.topic: reference
@@ -432,7 +432,7 @@ The query optimizer doesn't consider an index hint if the `SET` options don't ha
432
432
433
433
## Use NOEXPAND
434
434
435
-
`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*. Before [!INCLUDE [sssql16-md](../../includes/sssql16-md.md)] with Service Pack 1, automatic use of an indexed view by the query optimizer is supported only in specific editions of [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)]. In [!INCLUDE [sssql16-md](../../includes/sssql16-md.md)] with Service Pack 1 and later versions, all editions support automatic use of an indexed view. [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)] and [!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)] also support automatic use of indexed views without specifying the `NOEXPAND` hint.
435
+
`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*. Automatic use of an indexed view by the query optimizer is supported only in specific editions of [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)]. [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)] and [!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)] also support automatic use of indexed views without specifying the `NOEXPAND` hint.
436
436
437
437
For more information, see [Query processing architecture guide](../../relational-databases/query-processing-architecture-guide.md#use-hints-with-indexed-views).
0 commit comments