Category Archives: statistics

How to Move From ANALYZE DBMS_STATS

How to Move From ANALYZE/DBMS_UTILITY.ANALYZE_* to DBMS_STATS ============================================================= Cost-Based optimization relies on accurate statistics to determine the relative cost of execution plans. In Oracle 7, there was two methods to gather statistics: o ANALYZE o DBMS_UTILITY Since the Oracle Version … Continue reading

Posted in statistics | Leave a comment

How To Run DBMS_STATS.GATHER_TABLE_STATS Using Dynamic Query

Connect as scott, scott has DBA and ANALYSE ANY privileges create or replace procedure getstattest IS str1 varchar2(1000); cnt NUMBER; CURSOR c_C1 IS select TABLE_NAME, OWNER from dba_tables where OWNER IN (‘SCOTT’) and TABLE_NAME IN (‘EMP’, ‘DEPT’,’BONUS’,’SALGRADE’); begin FOR tab_rec … Continue reading

Posted in statistics | Leave a comment