虽然字数统计示例对于大量的问题是有用且适用的,但是其他的模型仍然在此总体框架内适用。
The word count example is useful and applicable to a large number of problems, but other models still fit within this general framework.
下面使用以上讨论的相同的示例数据,阐释在使用和不使用查询的统计视图的情况下基数估计的差别。
Using the same sample data just discussed above, the following illustrates the difference in cardinality estimates with and without the use of statistical view for the query.
表1给出了本文的示例场景收集到的粗略统计。
Table 1 shows the rough statistics gathered for this article's sample scenario.
对示例日志文件运行该脚本,将产生一些相关的统计信息,从而显示指定域的邮件数量和大小(请参见清单4)。
Running the script on a sample log file produces some statistics showing the mail counts and sizes for the domain specified (see Listing 4).
该示例显示,如果在表上发生WRITE活动时运行RUNSTATS,统计数据就可能与本示例中的不一致。
This example shows that if RUNSTATS is run while there is WRITE activity happening on the table, the statistics can be inconsistent as in this example.
让我们通过一个示例表来研究一下这两种不同类型的分布统计信息。
Let's examine the two different types by looking at a sample table.
示例18:收集所有索引以及列deptno和deptname上的目录统计信息。
Example 18: Collect catalog statistics on all indexes and on columns deptno and deptname.
图1显示了LotusDomino7中具有统计数据的示例Statrep . nsf数据库。
Figure 1 shows a sample Statrep.nsf database with statistical data in Lotus Domino 7.
图10:eurekaj演示程序的统计分组示例。
Figure 10: Example of statistics groups from the EurekaJ demonstration application.
示例5:收集表和索引上的目录统计信息,不包含分布统计信息。
Example 5: Collect catalog statistics on the table and indexes without distribution statistics.
示例9:收集表和索引上的目录统计信息,包含分布统计信息
Example 9: Collect catalog statistics on the table and indexes with distribution statistics
示例23:仅修改现有的统计信息配置文件,不收集任何目录统计信息。
Example 23: Modify an existing statistics profile only; no catalog statistics are collected.
示例20:收集所有列上的目录统计信息并指定varchar列上的LIKE统计信息。
Example 20: Collect catalog statistics on all columns and LIKE statistics on a specific VARCHAR column.
示例16:收集表上的目录统计信息,包含列deptno和deptname上的分布统计信息。
Example 16: Collect catalog statistics on table, with distribution statistics on columns deptno and deptname.
示例21:只注册一个统计信息配置文件,不收集目录统计信息
Example 21: Register a statistics profile only without collecting catalog statistics
这个示例使用-d选项显示适配器en2的所有统计数据,包括与设备相关的统计数据。
The example shown USES the -d switch to display all statistics, including device-specific statistics, for the adapter en2.
然后,运行这个示例应用程序,以下命令统计以“dfs”开头的单词出现的次数。
Then, run the sample, which counts occurrences of words that start with "DFS."
示例26:使用前面已注册的统计信息配置文件收集目录统计信息。
Example 26: Collect catalog statistics using a previously registered statistics profile.
示例7:只收集3个指定索引上的目录统计信息(不含表统计信息)。
Example 7: Collect catalog statistics on 3 specific indexes only (no table statistics).
这个示例解释说明了部分统计信息对于优化器估计基数的能力的影响。
This example illustrates the effect that partial statistics have on the ability of the optimizer to estimate the cardinality.
比起在整个示例应用程序中用分散的调用更新统计值和跟踪上下文,这是一个重大的改进。
This is a major improvement over scattering calls to update statistics and to track context throughout my example application.
收集这些统计信息后生成的查询访问计划与示例3中的最后的计划相同。
The query access plan produced after collecting these statistics is the same as the final plan in Example 3.
这个示例表明,如果将分布统计信息与参数标记一起使用,分布统计信息的作用就会受到限制。
The sample shows that distribution statistics are of limited use when used in conjunction with parameter markers.
示例4:收集关键列上和一个非关键列上的目录统计信息。
Example 4: Collect catalog statistics on key columns and on one column that is not.
示例13:收集构成索引的所有列以及两个非索引列中包含分布的目录统计信息。
Example 13: Collect catalog statistics with distribution on all columns that are part of the index, plus two columns that are not.
DB 2优化器对分布统计信息的使用——示例。
Usage of distribution statistics by the DB2 optimizer - a sample.
下列RUNSTATS示例收集基于索引的所有可能统计信息。
The following RUNSTATS example collects all possible statistics based on the indexes.
示例19:收集捕获了列组的目录统计信息。
Example 19: Collect catalog statistics that capture column groups.
示例8:只收集所有索引上的目录统计信息。
示例1:收集所有列上的统计信息。
应用推荐