Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

gather stats after index creation

cs01kksNov 26 2018 — edited Dec 4 2018

Hi All,

I am on Oracle version:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

PL/SQL Release 12.1.0.2.0 - Production

I would like to know if we need to gather stats on table after index creation? Does creation of index force system to gather statistics on table automatically? I tested this by looking at dba_tab_statistics.

I created a table with 100000 rows and looked at dba_tab_statistics - confirmed that number of rows, no of blocks and row length was populated. I then created index and again checked dba_tab_statistics. I could not see any difference.

I then used  DBMS_STATS.GATHER_TABLE_STATS and rechecked dba_tab_statistics. I could not see any difference in all above 3 test cases. Am I missing something here? My question is: do we need to run  DBMS_STATS.GATHER_TABLE_STATS after index creation? I know index creation will gather index stats but does gathering  index stats also gather table stats? please clarify with  dba_tab_statistics as proof of concept.

Thanks

kumar

This post has been answered by mathguy on Nov 26 2018
Jump to Answer
Comments
Post Details
Added on Nov 26 2018
5 comments
5,437 views