Oracle Database / SQL Performance & Memory
Check optimizer statistics for the actual table and partition
An optimizer can estimate poorly when statistics no longer represent the data. Inspect relevant table and partition statistics before gathering everything.
Environment and inputs: Oracle Database 19c baseline · SQL*Plus-compatible SQL unless RMAN, DGMGRL, ADRCI or a host shell is specified. Check release, patch level, edition and container first.
Start with this diagnostic
Run each example in the tool named in the guide: SQL, RMAN, DGMGRL or the host command shell. Replace example names with approved values. To query DBA and V$ views, use authorized catalog access in the correct database container. Do not add broad permissions just to run an example.
SELECT owner, table_name, partition_name, num_rows, last_analyzed, stale_stats FROM dba_tab_statistics WHERE owner = 'APP_OWNER' AND table_name = 'APP_ORDERS';
What the results mean
NUM_ROWS reflects statistics, not a live row count. STALE_STATS and LAST_ANALYZED need interpretation with modifications, partitioning and statistics preferences.
Fix the cause and check again
Compare the affected plan with data changes and statistics history. Plan a targeted approved statistics collection and validate critical statements afterward.
Before you make a change
Statistics collection consumes resources and can change plans. Do not gather schema-wide statistics during an incident without impact assessment.