← Performance
Oracle · Performance

How to find SQL doing full table scans in Oracle

List Oracle SQL_IDs currently in the shared pool that perform FULL table scans from V$SQL_PLAN, excluding SYS-owned objects.

Tested on11g12c18c19c21c23ai26ai

V$SQL_PLAN records the execution plan for every SQL still in the shared pool. Filter to operation = TABLE ACCESS with options = FULL to find every SQL currently doing full scans, then exclude the SYS / SYSTEM / DBSNMP objects that are expected to be scanned.

SELECT sql_id, object_owner, object_name
FROM   v$sql_plan
WHERE  operation = 'TABLE ACCESS'
AND    options   = 'FULL'
AND    object_owner NOT IN ('SYS', 'SYSTEM', 'DBSNMP');
performancefull table scanv$sql_plantuning