Merry Christmas & Happy 2027! Less downtime. More good times. Celebrating 13 years of sorlavit.com
Skip to content
Sorlavit KimIT Support, Network & Infrastructure Services Let’s talk

ปุ่มแปลไทยจะเปิดบทความผ่าน Google Translate เพื่อแปลอัตโนมัติ โดยคงโค้ดและคำสั่งไว้ตามต้นฉบับ

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.

Compiled for Sorlavit Kim · Published · Updated · 1 min read

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

Use the stated SQL, RMAN, DGMGRL or host shell and replace sample names with approved targets. DBA and V$ views need authorized catalog access in the correct container. Do not grant broad privileges for 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';

Read the result

NUM_ROWS reflects statistics, not a live row count. STALE_STATS and LAST_ANALYZED need interpretation with modifications, partitioning and statistics preferences.

Resolve and verify

Compare the affected plan with data changes and statistics history. Plan a targeted approved statistics collection and validate critical statements afterward.

Operational precautions

Statistics collection consumes resources and can change plans. Do not gather schema-wide statistics during an incident without impact assessment.

Share this article

Back to all articles