Sunday, December 4, 2011

Gathering stats in the database

Version 9.2 onwards You can gather stats of the database by the below ways:

GATHER_TABLE_STATS
EXEC DBMS_STATS.GATHER_TABLE_STATS (ownname =>'SCHEMA_NAME'',tabname=>'TABLE_NAME',method_opt => 'FOR ALL INDEXED COLUMNS SIZE AUTO',granularity =>'ALL',cascade => TRUE,degree => DBMS_STATS.DEFAULT_DEGREE);

GATHER_INDEX_STATS
Execute DBMS_STATS.GATHER_INDEX_STATS ('TEST','TEST_PK',estimate_percent => 30, degree => 6);

GATHER_SCHEMA_STATS
EXEC DBMS_STATS.GATHER_TABLE_STATS (ownname =>'SCHEMA_NAME'',estimate_percent=>dbms_stats.auto_sample_size,cascade=>TRUE,method_opt=>'FOR ALL COLUMNS SIZE AUTO',degree => 12)

No comments:

Post a Comment