table/index stats vs. system stats
Hi all.
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
PL/SQL Release 9.2.0.4.0 - Production
CORE 9.2.0.3.0 Production
TNS for Solaris: Version 9.2.0.4.0 - Production
NLSRTL Version 9.2.0.4.0 - Production
We are currently using a custom job to gather table and index stats:
BEGIN
rclp_app_msg.log('ANALYZE SYSADM', 10, 'START', 'Start of analyze AT ' || TO_CHAR(SYSDATE, '''HH:MI:SS'''), NULL, NULL);
for tab in (select table_name from user_tables where table_name not in (select table_name from user_external_tables))
loop
dbms_stats.gather_table_stats(ownname=>'SYSADM',tabname=>tab.table_name,estimate_percent=>dbms_stats.auto_sample_size);
end loop;
for idx in (select index_name from user_indexes)
loop
begin
dbms_stats.gather_index_stats(ownname=>'SYSADM',indname=>idx.index_name,estimate_percent=>dbms_stats.auto_sample_size);
exception
when others then null;
end;
end loop;
rclp_app_msg.log('ANALYZE SYSADM', 20, 'FINISH', 'Finish of analyze AT ' || TO_CHAR(SYSDATE, '''HH:MI:SS'''), NULL, NULL);
end;
I am thinking of scheduling a job to gather system stats instead and run it every hour.
EXEC DBMS_STATS.GATHER_SYSTEM_STATS('interval',interval => 60);
With this in place do I need to keep running my custom stats job or should the system stats suffice?
I also came across several forums indicating that setting the mreadtim to x2 of the sreadtim value:
begin
dbms_stats.set_system_stats('sreadtim',2);
dbms_stats.set_system_stats('mreadtim',5);
end;
Any input is appreciated.
Thanks