Documente Academic
Documente Profesional
Documente Cultură
DIRECT_WRITES 5,481,060
Note: The reason DIRECT_WRITES is much greater than DISK_READS is that the query was still writing the data to temp space and yet to read when v$sql was checked.
Note: The reason read requests (PHYSICAL_READ_REQUESTS) is 0 is that the query was still building the first hash table from the first row source.
Operation
Plan Id SID
HASH JOIN
HASH JOIN
17
17
1042
1107
11,435
11,433
HASH JOIN
HASH JOIN
17
17
1156
1223
11,432
11,432
1. The temp space usage is from plan Id 17: HASH JOIN 2. Since temp space is used, the first row source (Id 19 35) must be very large. 3. There is PX SEND BROADCAST for the first row source. It will amplify the temp space usages by the magnitude of DOP, in this case, DOP = 4. 4. When the row source of a HASH JOIN is already very large, BROADCAST PX distribute will make the join much harder.
1. Up to plan step 20, the first row source has generated 112,679,920 rows. The plan step 19 PX SEND BROADCAST amplified it to 450,719,680 rows. It definitely made the join much harder. 2. BROADCAST is supposed to be used for small row source distribution, that is how Oracle estimated for this query: 10421 rows for the first row source. Since Oracle estimate the second row source with 2.9M records, Oracle thought this join order was better.
2.
3.
The bad temp space usages with BROADCAST PX distribution is usually the result of bad cardinality estimates of the first row source. The root cause is either the inaccuracy of table stats or Oracles incapability to estimate JOIN cardinality. For this case, both are to be blamed:
The fact table involved does not have global stats. There is no explicit partition range for Oracle to use partition level stats. Multi column range partition scheme makes cardinality, join estimate and partition pruning complicated. BLOOM filter is disabled on UAD DB which makes partition pruning by join almost impossible.
4.
1. BUFFER SORT in PX is the result of that the operations on one row source/table is not parallelized, while the whole query runs in parallel. The BUFFER SORT operation happens when the query switches from serial operation to parallel operation. The temp space usage can be identified, using v$sql_workarea_active or v$sql_plan_monitor, or by researching the plan self if the query has completed long time ago. 2. In above case (DIRECT MARKETING, SEM), the query run with DOP 32, but the operation on the major row source, the fact table AGG_BY_SPACEID_KWOID_7D, was serial operation.