Quick question, after populating my table, I noticed through my explain plan that indexes, in most cases, only seems to take effect after I perform
Exec DBMS_STATS.GATHER_TABLE_STATS(ownname => 'USER/SCHEMA', tabname => 'MYTABLE', cascade=> true, degree=> 8);
The "CASCADE" attribute was defined as: Gather statistics on the indexes for this table. Index statistics gathering is not parallelized. Using this option is equivalent to running the
GATHER_INDEX_STATS Procedure on each of the table's indexes.
So my question is, should I run the
REBUILD of my indexes prior to
GATHER_TABLE_STATS, as I'm assuming gathering the index stats and rebuilding them IS NOT the same thing, or is it?
At the moment, I run
dbms_index_utl.build_table_indexes to rebuild my indexes followed by the
GATHER_TABLE_STATS, I just don't know if it's necessary, mind you my explain plan seems to indicate it is, otherwise, unless I add a hint to my query, the index won't get used.