Skip to Main Content
  • Questions
  • Set DBMS_STATS estimate_percent to 100

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Pierre.

Asked: January 20, 2026 - 3:44 pm UTC

Last updated: January 22, 2026 - 1:54 pm UTC

Version: 19.x

Viewed 100+ times

You Asked

To avoid unexpected execution plan changes some people say that we must set DBMS_STATS estimate_percent should always be to 100.

I would like to know if you agree with this ?

and Chris said...

We recommend you use auto sample size.

First up, plans can and will still change when you use an estimate of 100%. This is because plans can change for reasons unrelated to statistics (e.g. adding an index), and as your data changes over time, a different plan may become faster than the current fastest plan. So using an estimate of 100% to stop plan changes won't work.

Next, while a 100% sample will give the best stats, it is also the slowest. Auto sampling is designed to give the best performance with the highest accuracy:

This algorithm reads all rows and produces statistics that are nearly as accurate as statistics from a 100% sample.

https://docs.oracle.com/en/database/oracle/oracle-database/26/tgsql/gathering-optimizer-statistics.html#GUID-88E321BF-445E-40BD-83A2-9EA107689B2F

Auto sample size is also a prerequisite for some more recent optimizer features, such as:

* Incremental statistics
* Concurrent statistics
* New histogram types

e.g. with an estimate of 100%, the database will create height-balanced histograms. With auto, it can create Top-N or hybrid histograms instead:

create table t ( c1, c2 ) as
  select level, floor ( 50000 / level ) 
  connect by level <= 100000;

exec dbms_stats.gather_table_stats ( user, 't', estimate_percent => 100 );

select column_name, histogram 
from   user_tab_cols
where  table_name = 'T';

COLUMN_NAME    HISTOGRAM          
C1             HEIGHT BALANCED    
C2             HEIGHT BALANCED  

exec dbms_stats.gather_table_stats ( user, 't', estimate_percent => dbms_stats.auto_sample_size );

select column_name, histogram 
from   user_tab_cols
where  table_name = 'T';

COLUMN_NAME    HISTOGRAM        
C1             HYBRID           
C2             TOP-FREQUENCY    

Rating

  (1 rating)

Comments

Thanks

A reader, January 22, 2026 - 4:43 pm UTC


More to Explore

Performance

Get all the information about database performance in the Database Performance guide.