Oracle 12c 第 1 版偏斜数据直方图
Oracle 12c release 1 Histograms for skewed data
我们运行在 12.1.0.2.0 数据库上安装 Oracle Applications 12.2.4。当我执行以下查询时:
select DBMS_STATS.GET_PREFS('AUTOSTATS_TARGET') as autostats_target,
DBMS_STATS.GET_PREFS('CASCADE') as cascade,
DBMS_STATS.GET_PREFS('DEGREE') as degree,
DBMS_STATS.GET_PREFS('ESTIMATE_PERCENT') as estimate_percent,
DBMS_STATS.GET_PREFS('METHOD_OPT') as method_opt,
DBMS_STATS.GET_PREFS('NO_INVALIDATE') as no_invalidate,
DBMS_STATS.GET_PREFS('GRANULARITY') as granularity,
DBMS_STATS.GET_PREFS('PUBLISH') as publish,
DBMS_STATS.GET_PREFS('INCREMENTAL') as incremental,
DBMS_STATS.GET_PREFS('STALE_PERCENT') as stale_percent
from dual
我得到:
"AUTOSTATS_TARGET","CASCADE","DEGREE","ESTIMATE_PERCENT","METHOD_OPT","NO_INVALIDATE","GRANULARITY","PUBLISH","INCREMENTAL","STALE_PERCENT"
"AUTO","DBMS_STATS.AUTO_CASCADE","NULL","DBMS_STATS.AUTO_SAMPLE_SIZE","FOR ALL COLUMNS SIZE AUTO","DBMS_STATS.AUTO_INVALIDATE","AUTO","TRUE","FALSE","10"
然而当我运行:
select distinct histogram
from user_tab_col_statistics
我只得到NONE
Oracle 应用程序实例怎么可能没有带有需要直方图的偏差的表?还是我没看懂设置?
此外,当您想要在列上显示直方图时是否必须使用 method_opt => 'for all columns size skewonly'
?如何为所有列指定自动并为一列指定倾斜?
我真的很喜欢直方图可能带来的巨大速度提升,令我惊讶的是 Oracle Applications 默认情况下不提供此功能。有一个 Gather Schema Statistics 进程,每晚 运行s,可能是其中的代码很旧并且它会终止任何 dbms_stats 调用吗?我专门创建了以下应该有直方图的索引。
create index xxpqh_ss_trans_history_idx1 on hr.pqh_ss_transaction_history (process_name, nvl(selected_person_id, -1)) compress 1 tablespace apps_ts_tx_idx;
exec dbms_stats.gather_table_stats(ownname => 'HR', tabname => 'PQH_SS_TRANSACTION_HISTORY', cascade => true, method_opt => 'for all columns size skewonly');
Oracle 应用程序使用其 自己的 统计收集机制,您应该直接使用 dbms_stats。
"Oracle E-Business Suite statistics should only be gathered using FND_STATS or the Gather Statistics concurrent request. Gathering statistics with DBMS_STATS or the desupported ANALYZE command may result in suboptimal executions plans for E-Business Suite"
请参考以下白皮书获取建议:
使用 Oracle E-Business Suite 收集统计信息的最佳实践(MOS 说明 1586374.1)
我们运行在 12.1.0.2.0 数据库上安装 Oracle Applications 12.2.4。当我执行以下查询时:
select DBMS_STATS.GET_PREFS('AUTOSTATS_TARGET') as autostats_target,
DBMS_STATS.GET_PREFS('CASCADE') as cascade,
DBMS_STATS.GET_PREFS('DEGREE') as degree,
DBMS_STATS.GET_PREFS('ESTIMATE_PERCENT') as estimate_percent,
DBMS_STATS.GET_PREFS('METHOD_OPT') as method_opt,
DBMS_STATS.GET_PREFS('NO_INVALIDATE') as no_invalidate,
DBMS_STATS.GET_PREFS('GRANULARITY') as granularity,
DBMS_STATS.GET_PREFS('PUBLISH') as publish,
DBMS_STATS.GET_PREFS('INCREMENTAL') as incremental,
DBMS_STATS.GET_PREFS('STALE_PERCENT') as stale_percent
from dual
我得到:
"AUTOSTATS_TARGET","CASCADE","DEGREE","ESTIMATE_PERCENT","METHOD_OPT","NO_INVALIDATE","GRANULARITY","PUBLISH","INCREMENTAL","STALE_PERCENT"
"AUTO","DBMS_STATS.AUTO_CASCADE","NULL","DBMS_STATS.AUTO_SAMPLE_SIZE","FOR ALL COLUMNS SIZE AUTO","DBMS_STATS.AUTO_INVALIDATE","AUTO","TRUE","FALSE","10"
然而当我运行:
select distinct histogram
from user_tab_col_statistics
我只得到NONE
Oracle 应用程序实例怎么可能没有带有需要直方图的偏差的表?还是我没看懂设置?
此外,当您想要在列上显示直方图时是否必须使用 method_opt => 'for all columns size skewonly'
?如何为所有列指定自动并为一列指定倾斜?
我真的很喜欢直方图可能带来的巨大速度提升,令我惊讶的是 Oracle Applications 默认情况下不提供此功能。有一个 Gather Schema Statistics 进程,每晚 运行s,可能是其中的代码很旧并且它会终止任何 dbms_stats 调用吗?我专门创建了以下应该有直方图的索引。
create index xxpqh_ss_trans_history_idx1 on hr.pqh_ss_transaction_history (process_name, nvl(selected_person_id, -1)) compress 1 tablespace apps_ts_tx_idx;
exec dbms_stats.gather_table_stats(ownname => 'HR', tabname => 'PQH_SS_TRANSACTION_HISTORY', cascade => true, method_opt => 'for all columns size skewonly');
Oracle 应用程序使用其 自己的 统计收集机制,您应该直接使用 dbms_stats。
"Oracle E-Business Suite statistics should only be gathered using FND_STATS or the Gather Statistics concurrent request. Gathering statistics with DBMS_STATS or the desupported ANALYZE command may result in suboptimal executions plans for E-Business Suite"
请参考以下白皮书获取建议:
使用 Oracle E-Business Suite 收集统计信息的最佳实践(MOS 说明 1586374.1)