Do you have capability to run sql trace on these SQL's ? (with waits)Hello Connor/Chris,
We tried once to run sql trace on entire app job but we did not manage to capture all the work (thanks to the DBAs who did it).
However, we have managed to capture sql trace for GATHER_TABLE_STATS call for a table, from 12c and 19c.
12c:
PQ Coordinator:
SQL ID: b0vg2w1auktgw Plan Hash: 4250307043
select /*+ full(t) parallel(t,2) parallel_index(t,2) dbms_stats
cursor_sharing_exact use_weak_name_resl dynamic_sampling(0) no_monitoring
xmlindex_sel_idx_tbl no_substrb_pad
*/to_char(count("STANDARD_REFERENCE_ID")),
substrb(dump(min("STANDARD_REFERENCE_ID"),16,0,64),1,240),
substrb(dump(max("STANDARD_REFERENCE_ID"),16,0,64),1,240),
to_char(count("BILLED_AND_UNPAID_PRINCIPAL")),
substrb(dump(min("BILLED_AND_UNPAID_PRINCIPAL"),16,0,64),1,240),
substrb(dump(max("BILLED_AND_UNPAID_PRINCIPAL"),16,0,64),1,240),
to_char(count("ESCROW_SHORTAGE_BAL")),
substrb(dump(min("ESCROW_SHORTAGE_BAL"),16,0,64),1,240),
substrb(dump(max("ESCROW_SHORTAGE_BAL"),16,0,64),1,240),
to_char(count("PROCESSING_GROUP_CODE")),
substrb(dump(min("PROCESSING_GROUP_CODE"),16,0,64),1,240),
substrb(dump(max("PROCESSING_GROUP_CODE"),16,0,64),1,240),
to_char(count("LOAN_STATUS")),substrb(dump(min("LOAN_STATUS"),16,0,64),1,
240),substrb(dump(max("LOAN_STATUS"),16,0,64),1,240),
to_char(count("PRODUCT_KEY")),substrb(dump(min("PRODUCT_KEY"),16,0,64),1,
240),substrb(dump(max("PRODUCT_KEY"),16,0,64),1,240),
to_char(count("CUSTOMER_KEY")),substrb(dump(min("CUSTOMER_KEY"),16,0,64),1,
240),substrb(dump(max("CUSTOMER_KEY"),16,0,64),1,240),
to_char(count("INVESTOR_KEY")),substrb(dump(min("INVESTOR_KEY"),16,0,64),1,
240),substrb(dump(max("INVESTOR_KEY"),16,0,64),1,240),
to_char(count("OWNER_KEY")),substrb(dump(min("OWNER_KEY"),16,0,64),1,240),
substrb(dump(max("OWNER_KEY"),16,0,64),1,240),
to_char(count("OWNERSHIP_PERCENT")),substrb(dump(min("OWNERSHIP_PERCENT"),
16,0,64),1,240),substrb(dump(max("OWNERSHIP_PERCENT"),16,0,64),1,240),
to_char(count("CURRENT_PRINCIPAL_BALANCE")),
substrb(dump(min("CURRENT_PRINCIPAL_BALANCE"),16,0,64),1,240),
substrb(dump(max("CURRENT_PRINCIPAL_BALANCE"),16,0,64),1,240),
to_char(count("INTEREST_BALANCE")),substrb(dump(min("INTEREST_BALANCE"),16,
0,64),1,240),substrb(dump(max("INTEREST_BALANCE"),16,0,64),1,240),
to_char(count("FEE_BALANCE")),substrb(dump(min("FEE_BALANCE"),16,0,64),1,
240),substrb(dump(max("FEE_BALANCE"),16,0,64),1,240),
to_char(count("OTHER_BALANCES")),substrb(dump(min("OTHER_BALANCES"),16,0,64)
,1,240),substrb(dump(max("OTHER_BALANCES"),16,0,64),1,240),
to_char(count("DAILY_INTEREST")),substrb(dump(min("DAILY_INTEREST"),16,0,64)
,1,240),substrb(dump(max("DAILY_INTEREST"),16,0,64),1,240),
to_char(count("SCHEDULED_PRINCIPAL_BALANCE")),
substrb(dump(min("SCHEDULED_PRINCIPAL_BALANCE"),16,0,64),1,240),
substrb(dump(max("SCHEDULED_PRINCIPAL_BALANCE"),16,0,64),1,240),
to_char(count("PAST_DUE_INTEREST_ACTUAL")),
substrb(dump(min("PAST_DUE_INTEREST_ACTUAL"),16,0,64),1,240),
substrb(dump(max("PAST_DUE_INTEREST_ACTUAL"),16,0,64),1,240),
to_char(count("TOTAL_PAST_DUE_ACTUAL")),
substrb(dump(min("TOTAL_PAST_DUE_ACTUAL"),16,0,64),1,240),
substrb(dump(max("TOTAL_PAST_DUE_ACTUAL"),16,0,64),1,240),
to_char(count("CA_CURRENCY_FX_RATE")),
substrb(dump(min("CA_CURRENCY_FX_RATE"),16,0,64),1,240),
substrb(dump(max("CA_CURRENCY_FX_RATE"),16,0,64),1,240),
to_char(count("CA_CURRENCY_FX_OPERATOR")),
substrb(dump(min("CA_CURRENCY_FX_OPERATOR"),16,0,64),1,240),
substrb(dump(max("CA_CURRENCY_FX_OPERATOR"),16,0,64),1,240),
to_char(count("CURRENT_USER_DEFINED_BALANCE_1")),
substrb(dump(min("CURRENT_USER_DEFINED_BALANCE_1"),16,0,64),1,240),
substrb(dump(max("CURRENT_USER_DEFINED_BALANCE_1"),16,0,64),1,240),
to_char(count("CURRENT_USER_DEFINED_BALANCE_2")),
substrb(dump(min("CURRENT_USER_DEFINED_BALANCE_2"),16,0,64),1,240),
substrb(dump(max("CURRENT_USER_DEFINED_BALANCE_2"),16,0,64),1,240),
to_char(count("CA_CURRENCY_CODE")),substrb(dump(min("CA_CURRENCY_CODE"),16,
0,64),1,240),substrb(dump(max("CA_CURRENCY_CODE"),16,0,64),1,240),
to_char(count("CURRENCY_MONTH_ID")),substrb(dump(min("CURRENCY_MONTH_ID"),
16,0,64),1,240),substrb(dump(max("CURRENCY_MONTH_ID"),16,0,64),1,240),
to_char(count("DAY_ID")),substrb(dump(min("DAY_ID"),16,0,64),1,240),
substrb(dump(max("DAY_ID"),16,0,64),1,240),to_char(count("SEQUENCE_NO")),
substrb(dump(min("SEQUENCE_NO"),16,0,64),1,240),
substrb(dump(max("SEQUENCE_NO"),16,0,64),1,240),
to_char(count("PORTFOLIO_ID")),substrb(dump(min("PORTFOLIO_ID"),16,0,64),1,
240),substrb(dump(max("PORTFOLIO_ID"),16,0,64),1,240),
to_char(count("NET_INTEREST_BILLING_RATE")),
substrb(dump(min("NET_INTEREST_BILLING_RATE"),16,0,64),1,240),
substrb(dump(max("NET_INTEREST_BILLING_RATE"),16,0,64),1,240),
to_char(count("CURRENT_GL_BALANCE")),substrb(dump(min("CURRENT_GL_BALANCE"),
16,0,64),1,240),substrb(dump(max("CURRENT_GL_BALANCE"),16,0,64),1,240),
to_char(count("ORIG_ESCROW_BAL")),substrb(dump(min("ORIG_ESCROW_BAL"),16,0,
64),1,240),substrb(dump(max("ORIG_ESCROW_BAL"),16,0,64),1,240),
to_char(count("CURR_ESCROW_BAL")),substrb(dump(min("CURR_ESCROW_BAL"),16,0,
64),1,240),substrb(dump(max("CURR_ESCROW_BAL"),16,0,64),1,240),
to_char(count("BILLED_AND_UNPAID_ESCROW")),
substrb(dump(min("BILLED_AND_UNPAID_ESCROW"),16,0,64),1,240),
substrb(dump(max("BILLED_AND_UNPAID_ESCROW"),16,0,64),1,240),
to_char(count("PREPAID_ESCROW")),substrb(dump(min("PREPAID_ESCROW"),16,0,64)
,1,240),substrb(dump(max("PREPAID_ESCROW"),16,0,64),1,240),
to_char(count("ESCROW_CHANGES_MEMO_POST_TODAY")),
substrb(dump(min("ESCROW_CHANGES_MEMO_POST_TODAY"),16,0,64),1,240),
substrb(dump(max("ESCROW_CHANGES_MEMO_POST_TODAY"),16,0,64),1,240),
to_char(count("LOAN_CURRENCY_CODE")),substrb(dump(min("LOAN_CURRENCY_CODE"),
16,0,64),1,240),substrb(dump(max("LOAN_CURRENCY_CODE"),16,0,64),1,240),
count(rowidtochar(rowid))
from
"FOWNER"."FACTTBL1" t /* NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,
NDV,NIL,NIL,TOPN,NIL,NIL,TOPN,NIL,NIL,TOPN,NIL,NIL,TOPN,NIL,NIL,TOPN,NIL,
NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,
NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,
NIL,NIL,NDV,NIL,NIL,TOPN,NIL,NIL,TOPN,NIL,NIL,NDV,NIL,NIL,TOPN,NIL,NIL,NDV,
NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,NIL,NDV,NIL,
NIL,TOPN,NIL,NIL,RWID,U254,U254,U254,U254,U254,U254,U254,U254,U254,U254,
U254,U254,U254,U254,U254,U254,U254,U254,U254,U254,U254,U254,U254,U254,U254,
U254,U254,U254,U254,U254,U254,U254,U254,U254,U254U*/
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.01 3 13 0 0
Fetch 1 0.41 899.28 0 0 0 1
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 3 0.42 899.31 3 13 0 1
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 223 (recursive depth: 1)
Number of plan statistics captured: 1
Rows (1st) Rows (avg) Rows (max) Row Source Operation
---------- ---------- ---------- ---------------------------------------------------
1 1 1 SORT AGGREGATE (cr=13 pr=3 pw=0 time=899303148 us)
2 2 2 PX COORDINATOR (cr=13 pr=3 pw=0 time=899300825 us)
0 0 0 PX SEND QC (RANDOM) :TQ10000 (cr=0 pr=0 pw=0 time=0 us)
0 0 0 SORT AGGREGATE (cr=0 pr=0 pw=0 time=0 us)
0 0 0 OPTIMIZER STATISTICS GATHERING (cr=0 pr=0 pw=0 time=0 us cost=1753384 size=85039113824 card=841971424)
0 0 0 PX BLOCK ITERATOR (cr=0 pr=0 pw=0 time=0 us cost=1753384 size=85039113824 card=841971424)
0 0 0 TABLE ACCESS FULL FACTTBL1 (cr=0 pr=0 pw=0 time=0 us cost=1753384 size=85039113824 card=841971424)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
Disk file operations I/O 3 0.00 0.00
KSV master wait 6 0.00 0.00
ASM file metadata operation 3 0.00 0.00
db file sequential read 3 0.00 0.00
PX Deq: Join ACK 4 0.00 0.00
PX Deq: Parse Reply 2 0.00 0.00
PX Deq: Execute Reply 700 58.10 898.88
PX Deq: Signal ACK EXT 2 0.00 0.00
PX Deq: Slave Session Stats 2 0.00 0.00
enq: PS - contention 1 0.00 0.00
********************************************************************************
PQ Slave 1:
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 898.50 899.28 5845366 5847704 0 0
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 2 898.50 899.28 5845366 5847704 0 0
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 223 (recursive depth: 1)
Number of plan statistics captured: 1
Rows (1st) Rows (avg) Rows (max) Row Source Operation
---------- ---------- ---------- ---------------------------------------------------
0 0 0 SORT AGGREGATE (cr=0 pr=0 pw=0 time=0 us)
0 0 0 PX COORDINATOR (cr=0 pr=0 pw=0 time=0 us)
0 0 0 PX SEND QC (RANDOM) :TQ10000 (cr=0 pr=0 pw=0 time=0 us)
1 1 1 SORT AGGREGATE (cr=5847704 pr=5845366 pw=0 time=899284133 us)
425594545 425594545 425594545 OPTIMIZER STATISTICS GATHERING (cr=5847704 pr=5845366 pw=0 time=602932896 us cost=1753384 size=85039113824 card=841971424)
425594545 425594545 425594545 PX BLOCK ITERATOR (cr=5847704 pr=5845366 pw=0 time=119367894 us cost=1753384 size=85039113824 card=841971424)
425594545 425594545 425594545 TABLE ACCESS FULL FACTTBL1 (cr=5847704 pr=5845366 pw=0 time=76216225 us cost=1753384 size=85039113824 card=841971424)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
PX Deq: Execution Msg 131 0.00 0.01
Disk file operations I/O 34 0.00 0.00
KSV master wait 34 0.04 0.07
ASM file metadata operation 17 0.00 0.00
direct path read 160 0.00 0.31
PX Deq Credit: send blkd 102 0.01 0.13
PX Deq Credit: need buffer 1 0.00 0.00
PX Deq Credit: free buffer 7 0.00 0.00
PX qref latch 1 0.00 0.00
********************************************************************************
PQ Slave 2:
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 887.67 888.44 5709314 5711637 0 0
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 2 887.67 888.44 5709314 5711637 0 0
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 223 (recursive depth: 1)
Number of plan statistics captured: 1
Rows (1st) Rows (avg) Rows (max) Row Source Operation
---------- ---------- ---------- ---------------------------------------------------
0 0 0 SORT AGGREGATE (cr=0 pr=0 pw=0 time=0 us)
0 0 0 PX COORDINATOR (cr=0 pr=0 pw=0 time=0 us)
0 0 0 PX SEND QC (RANDOM) :TQ10000 (cr=0 pr=0 pw=0 time=0 us)
1 1 1 SORT AGGREGATE (cr=5711637 pr=5709314 pw=0 time=888440424 us)
416376879 416376879 416376879 OPTIMIZER STATISTICS GATHERING (cr=5711637 pr=5709314 pw=0 time=594194927 us cost=1753384 size=85039113824 card=841971424)
416376879 416376879 416376879 PX BLOCK ITERATOR (cr=5711637 pr=5709314 pw=0 time=116119851 us cost=1753384 size=85039113824 card=841971424)
416376879 416376879 416376879 TABLE ACCESS FULL FACTTBL1 (cr=5711637 pr=5709314 pw=0 time=73632031 us cost=1753384 size=85039113824 card=841971424)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
PX Deq: Execution Msg 132 10.84 10.86
Disk file operations I/O 35 0.00 0.00
latch free 1 0.00 0.00
oracle thread bootstrap 1 0.02 0.02
KSV master wait 19 0.00 0.01
ASM file metadata operation 10 0.00 0.00
direct path read 149 0.00 0.30
PX Deq Credit: send blkd 119 0.01 0.20
PX Deq Credit: free buffer 5 0.00 0.00
PX Deq Credit: need buffer 1 0.00 0.00
********************************************************************************