Common Root Causes
- HASH JOIN or SORT ORDER BY exceeded PGA memory and spilled to TEMP (Used-Tmp > 0).
- Cartesian join (MERGE JOIN CARTESIAN) exploding intermediate row counts.
- SELECT * carrying wide unused VARCHAR2/CLOB columns through a sort or hash build.
Proven Tuning Fixes
- Paste the plan into McSQL Plan X-Ray to spot Used-Tmp and multipass operations.
- Project only needed columns and push selective WHERE filters earlier.
- Review PGA_AGGREGATE_TARGET and PGA_AGGREGATE_LIMIT sizing.
Diagnostic V$ Query
SELECT sql_id, operation_type, tempseg_size/1048576 AS temp_mb
FROM v$sql_workarea_active WHERE tempseg_size > 0 ORDER BY tempseg_size DESC;