有了这个特性,查询优化器可以在决定访问计划时立即考虑索引。
With this feature, the query optimizer can immediately consider the index when determining an access plan.
因此,我们在这些连接列上添加了索引,从下列查询执行计划中我们可以看到,查询成本减少了很多。
So we added indexes on those joining columns and from the following query execution plan, we can see the query cost is greatly reduced.
现在看一下这三个新操作符,以及它们与xml索引在执行计划中是如何工作的。
Now take a look at the three new operators and how they work together with XML indexes in a query execution plan.
该查询计划展示了函数索引的使用。
接下来将深入讨论如何创建和使用函数索引,以及如何生成和检验查询计划,并提供具体的示例。
The in-depth discussion and examples that follow explore creating and using functional indexes and how to generate and examine query plans.
如果计划包括对扩展索引的一个扫描,您将发现EISCAN(在图3中高亮显示)。
If the plan includes a scan of the extended index you will see the EISCAN (highlighted in Figure 3).
现在将用优化器根据实际和虚拟索引选择的访问计划来填充解释表。
This now populates the explain tables with the access plan chosen by the optimizer based on real and virtual indexes.
优化器将以一种基于成本的方式为IXAND计划挑选额外的索引。
The optimizer picks additional indexes for the IXAND plan in a cost-based fashion.
优化器在XAND OR计划中使用所有合适的xml索引。
The optimizer USES all applicable XML indexes in the XANDOR plan.
调优包括添加额外索引来生成一个更高效的访问计划,让表格变幻无常,进而鼓励索引的使用,如果可能的话也可以避免表扫描。
Tuning can include adding extra indexes to yield a more efficient access plan, which makes tables volatile to encourage index usage and avoid table scans if possible.
为检查在查询时是否真正使用了一个空间网格索引,应该查看一下访问计划。
To check if a spatial grid index is actually exploited during query time, you should have a look at the access plan.
优化器可能会以一种基于成本的方式将更多索引加入到 IXAND计划中。
The optimizer may add more indexes to the IXAND plan in a cost-based fashion.
为了便于比较,图3显示了通过将SELECTIVITY1子句添加到where子句的谓词中,强迫db2优化器忽略索引的访问计划。
For comparison, Figure 3 illustrates the access plan where I forced the DB2 optimizer to ignore the index by adding the clause SELECTIVITY 1 to the predicate in the where clause.
该查询计划显示索引扫描使用了函数索引。
This query plan shows an index scan using our functional index.
在访问计划图的表或索引节点上会有一个RUNSTATSTIMESTAMP属性,它表示收集统计数据的时间。
There is an attribute RUNSTATS TIMESTAMP on the table or index node of the access plan graph that indicates the last time when the statistics were collected.
在多数情况下,本地索引不保留跨分区的顺序属性,如果计划采用本地索引,还需要进行额外的排序操作。
In most cases, local indexes do not preserve the order property across partitions and that requires an extra sort if the plan is using local indexes.
创建三个新索引之后,您图13中的新访问计划图。
After creating the three new indexes, you get the new access plan graph shown in Figure 13.
图12确认查询的访问计划中使用了staff表上的新索引。
Figure 12 confirms that the new index on the STAFF table is being used in the query access plan.
如果未指定索引名,优化器将选用成本最低的XML 索引访问计划。
When the index name is not specified, optimizer picks the cheapest single XML index access plan.
INDEX元素可以选择性地指定两个或更多索引,它们将按照指定的顺序应用到“IXAND”计划中,并且优化器不会向IXAND添加更多的索引。
The index elements can optionally specify two or more indexes that will be used in the 'IXAND' plan in the specified order and no additional indexes will be added by the optimizer to the IXAND.
index属性是可选的,并允许您指定一个索引名来作为“IXAND”计划中的主索引。
The index attribute is optional and allows you to specify an index name that will be used as the leading index in an 'IXAND' plan.
访问反向文本索引的查询的访问计划。
为了在account表上创建索引之后评估新的访问计划,要发出。
To evaluate the new access plan after the index creation on the ACCOUNT table issue.
您应当使用REBUILDINDEXES实用程序计划和构建这样的索引。
You should plan for and build such indexes using the REBUILD indexes utility.
如果使用IXAND或ACCESS准则指定了特定的主索引,但是没有获得所请求的计划,那么检查以下内容。
If you are using an IXAND or ACCESS guideline to specify a particular leading index, but are not getting the requested plan, check the following.
在这里我们使用了两个索引,并且有同样的谓词,这一次针对计划中编号为3的索引扫描。
Here we are using the two indexes, and we have the same predicate, this time on the index scan numbered 3 in the plan.
访问hash索引的查询的访问计划。
未使用反向文本索引的查询的访问计划。
如果该查询中没有合适的索引用于谓词,则使用最左边的计划(a)。
The leftmost plan (a) is used if there is no eligible index for the predicates in this query.
如果有用于两个谓词的索引,则可以参看图2中的计划(c)。
If you have indexes for both predicates you may see execution plan (c) in Figure 2.
应用推荐