Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

table/index stats vs. system stats

user222828Jun 16 2010 — edited Jun 16 2010
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 14 2010
Added on Jun 16 2010
5 comments
918 views