Oracle 视图 ALL_TAB_HISTOGRAMS 官方解释,作用,如何使用详细说明
本站中文解释
Oracle视图ALL_TAB_HISTOGRAMS用来表示系统中各个标量统计信息的直方图。它可以用来存储用户数据信息的直方图,可以显示某一列的数据的值分布情况。它可以提升SQL使用分析函数、索引用途等的性能,并有助于分析表中的数据。
ALL_TAB_HISTOGRAMS中的列含义包括:OWNER(所属的用户)、TABLE_NAME(视图或表名)、COLUMN_NAME(列名)、ENDPOINT_NUMBER(端点号)、ENDPOINT_ACTUAL_VALUE(端点实际值)、NUM_DISTINCT(不重复值数)、LAST_ANALYZED(上次分析时间)、FRACTION_DISTINCT(不重复值占比)。
可以使用下面的SQL查询ALL_TAB_HISTOGRAMS来查看表或视图中直方图信息:
SELECT * FROM ALL_TAB_HISTOGRAMS WHERE TABLE_NAME=’表名’ AND COLUMN_NAME=’列名’;
其中TABLE_NAME和COLUMN_NAME是必填项。这可以给用户带来实用的信息,帮助用户更好的改善查询性能。
官方英文解释
ALL_TAB_HISTOGRAMS
describes histograms on tables and views accessible to the current user.
The ALL_TAB_HISTOGRAMS
view may contain a one-bucket histogram, which in fact signifies “No histogram” to the Oracle Database software. Therefore, it should not be queried to indicate the presence or absence of a histogram on a particular column. Instead, query the value of column HISTOGRAM
in the ALL_TAB_COL_STATISTICS
view.
Related Views
-
DBA_TAB_HISTOGRAMS
describes histograms on all tables and views in the database. -
USER_TAB_HISTOGRAMS
describes histograms on all tables and views owned by the current user. This view does not display theOWNER
column.
Note:
These views are populated only if you collect statistics on the table using the DBMS_STATS
package. For more information, see Oracle Database PL/SQL
Packages and Types Reference.
Column | Datatype | NULL | Description |
---|---|---|---|
|
|
Owner of the table |
|
|
|
Name of the table |
|
|
|
Column name or attribute of the object type column |
|
|
|
Histogram bucket number |
|
|
|
Normalized endpoint value for this bucket |
|
|
|
Actual (not normalized) string value of the endpoint for this bucket |
|
|
|
Endpoint actual value in raw format |
|
|
|
Frequency of the endpoint (applies only to hybrid histograms, and is set to 0 for other histogram types) |
|
|
|
The value is For a global tempoary table, the possible values are:
See Oracle Database PL/SQL |
See Also:
-
“DBA_TAB_HISTOGRAMS”
-
“USER_TAB_HISTOGRAMS”
-
“ALL_TAB_COL_STATISTICS”