| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Performance impact of MONITORING and GATHER_STALE
Hi Leng
>Thanks for the clarification! Ok, now back on track. Yes, agreed. 10% =
is
>not necessarily the best rule of thumb but it's better than nothing I
>guess.
If you don't like the 10% you could try something like this:
CREATE OR REPLACE VIEW stale_statistics AS
SELECT DISTINCT table_name
FROM (
SELECT ut.table_name, -- tables modified via DML statements
sum(ut.num_rows)/sum(utm.inserts+utm.updates+utm.deletes) val
FROM user_tab_modifications utm, user_tables ut
WHERE utm.table_name =3D ut.table_name
GROUP BY ut.table_name
2) gather statistics based on the tables returned by the view
BEGIN
FOR tablist IN (SELECT * FROM stale_statistics) LOOP
DBMS_STATS.GATHER_TABLE_STATS(
ownname =3D> user,=20
tabname =3D> tablist.table_name,
estimate_percent =3D> 1,
cascade =3D> TRUE);
-- http://www.freelists.org/webpage/oracle-lReceived on Thu Mar 17 2005 - 02:07:18 CST
![]() |
![]() |