dbalearner
Technical User
I have recently been given responsibility for a back office Oracle 9i system. Users were complaining that putting through 1000 trades using one schema takes roughly an hour. On further investigation I noticed that out of 350 tables only three big tables has the stats updated in May this year!
In actual fact if I do a rowcount on these tables as shown below the number of rows is much higher
Tables with stats on = 3
Tables with no stats on = 347
TABLE_NAME BYTES NUM_ROWS Last Analyzed
------------------------------ ---------- ---------- --------------------
ACCOUNT_POSTING 981467136 378723 2005/05/18
AUDIT_MVT 578813952 1050945 2005/05/18
HISTOMVTS 134217728 201394 2005/05/18
Total count of rows in ACCOUNT_POSTING = 7538240
Total count of rows in AUDIT_MVT = 2901447
Total count of rows in HISTOMVTS = 573802
I have already backed up whatever the stats is for this schema using the following:
EXEC DBMS_STATS.CREATE_STAT_TABLE ('SOPHISNY','SOPHIS_STATISTICS','USERS');
EXEC DBMS_STATS.EXPORT_SCHEMA_STATS ('SOPHISNY','SOPHIS_STATISTICS','SOPHISNY','SOPHISNY');
Now I would like to update stats in all this schema's tables using the following:
DBMS_STATS.gather_schema_stats(
ownname => 'SOPHISNY',
cascade => true);
Since tables are fairly small I have opted for full (as opposed to ESTIMATE option). Believe it or not we do not have a dev environment for this application so I have to update stats in production without testing it. However, I am convinced that it will only do good. I will then finish the task by:
alter system flush shared_pool;
The questions that I have are
1) Does this approach make sense and there will not be any side effects (in case)
2) With full schema stats what sort of locking is applied to tables and indexes and will there be any blocking locks. Obviously I will be doing this task at a maintenance time
3) I have been tol to believe that update stats is only required if more than 10% of rows in underlying table ared added or removed. I can easily do the update stats nightly. If so will there be any detrimental effect? Or shall I opt for weekly update stats?
Many thanks,
Learner
In actual fact if I do a rowcount on these tables as shown below the number of rows is much higher
Tables with stats on = 3
Tables with no stats on = 347
TABLE_NAME BYTES NUM_ROWS Last Analyzed
------------------------------ ---------- ---------- --------------------
ACCOUNT_POSTING 981467136 378723 2005/05/18
AUDIT_MVT 578813952 1050945 2005/05/18
HISTOMVTS 134217728 201394 2005/05/18
Total count of rows in ACCOUNT_POSTING = 7538240
Total count of rows in AUDIT_MVT = 2901447
Total count of rows in HISTOMVTS = 573802
I have already backed up whatever the stats is for this schema using the following:
EXEC DBMS_STATS.CREATE_STAT_TABLE ('SOPHISNY','SOPHIS_STATISTICS','USERS');
EXEC DBMS_STATS.EXPORT_SCHEMA_STATS ('SOPHISNY','SOPHIS_STATISTICS','SOPHISNY','SOPHISNY');
Now I would like to update stats in all this schema's tables using the following:
DBMS_STATS.gather_schema_stats(
ownname => 'SOPHISNY',
cascade => true);
Since tables are fairly small I have opted for full (as opposed to ESTIMATE option). Believe it or not we do not have a dev environment for this application so I have to update stats in production without testing it. However, I am convinced that it will only do good. I will then finish the task by:
alter system flush shared_pool;
The questions that I have are
1) Does this approach make sense and there will not be any side effects (in case)
2) With full schema stats what sort of locking is applied to tables and indexes and will there be any blocking locks. Obviously I will be doing this task at a maintenance time
3) I have been tol to believe that update stats is only required if more than 10% of rows in underlying table ared added or removed. I can easily do the update stats nightly. If so will there be any detrimental effect? Or shall I opt for weekly update stats?
Many thanks,
Learner