我们在 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 应用程序默认情况下不提供这一点。有一个每天晚上运行的 Gather Schema Statistics 进程,是不是其中的代码非常旧并且它会杀死任何 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');