// oracle · query planner

optimizer_adaptive_statistics

Allow SQL plan directives, statistics feedback and dynamic sampling triggered by them.

デフォルト
FALSE
Range
TRUE, FALSE
Restart needed
いいえ
Default checked on
Oracle AI Database 26ai / 23ai

何ができるか

In 12.1 these were on by default and caused excessive hard parsing and dynamic sampling on some systems, so 12.2 made them off by default.

デフォルト値

FALSE. FALSE since Oracle 12.2. Same in 23ai.

Check the current value

SHOW PARAMETER optimizer_adaptive_statistics

SELECT name, value, isdefault, issys_modifiable, isses_modifiable, ispdb_modifiable
FROM v$parameter
WHERE name = 'optimizer_adaptive_statistics';

Change it

ALTER SESSION SET optimizer_adaptive_statistics = TRUE;   -- this session

ALTER SYSTEM SET optimizer_adaptive_statistics = TRUE SCOPE=BOTH;

No restart: ALTER SYSTEM with SCOPE=BOTH applies immediately and is saved in the SPFILE. A session can also change its own value with ALTER SESSION. It can be set inside a PDB (ISPDB_MODIFIABLE = TRUE).

When to change it

Analytic workloads with complex predicates where estimates are poor and parse time is not an issue.

What can go wrong

More hard parses and recursive dynamic-sampling queries.

Questions about optimizer_adaptive_statistics

What is the default value of optimizer_adaptive_statistics in Oracle?

FALSE. FALSE since Oracle 12.2. Same in 23ai.

Does changing optimizer_adaptive_statistics require a restart?

No. No restart: ALTER SYSTEM with SCOPE=BOTH applies immediately and is saved in the SPFILE. A session can also change its own value with ALTER SESSION. It can be set inside a PDB (ISPDB_MODIFIABLE = TRUE).

When should I change optimizer_adaptive_statistics?

Analytic workloads with complex predicates where estimates are poor and parse time is not an issue.

Back to all Oracle settings, or check the Oracle manual for every option.

// one client for every engine

Check optimizer_adaptive_statistics on your own server

SQLly runs the query above against Oracle and the other engines in this reference, from one desktop app on macOS, Windows and Linux.