Hello,
I'm facing a performance issues on a SAP Netweaver Stack on a MaxDB 7.9.08.015.
The SAP report that is not performing well is using a table in a join spanning 3 tables. The table is empty initially. During the report execution it is filled with 20000+ records. Then the join is run and after the report execution the table is empty again.
I have found out that when I set a breakpoint right before the join is executed (the table is filled with 20000+ records) and then execute an "update statistics <tablename>", the join will finish in milliseconds.
If I run the "update statistics <tablename>" on the empty table (which is useless, I guess?) the join will run minutes - up to 20 minutes.
Do you have any recommendation how to approach this issue in a productive system where I can not set breakpoints?
Below you can find the explains for an update statistics on the empty and on the filled table.
Regards,
Jens
This is the explain with update statistics on the empty table RR00K00G03X_DQ:
SELECT
DISTINCT T_01 . "C5" "EXTRACTKEY" , T_00 . "DEVID" "DEVID"
FROM
"RR00K00G03X_DQ" T_00 INNER JOIN "ZDOE00G03702" T_01 ON T_01 . "CLIENT" = ? AND T_01 . "EXTRACTKEY
" = T_00 . "INSID" INNER JOIN "ZDOE00G03X00" T_02 ON T_02 . "CLIENT" = ? AND T_02 . "EXTRACTKEY" =
T_01 . "C5"
WHERE
T_00 . "CLIENT" = ? AND T_00 . "SEQNO" IN ( ? , ? , ? , ? , ? )
Execution Plan
OWNER TABLENAME COLUMN OR INDEX STRATEGY PAGECOUNT
T_00 RANGE CONDITION FOR KEY 1
CLIENT (USED KEY COLUMN)
SEQNO (USED KEY COLUMN)
T_01 ZDOE00G03702~EKI JOIN VIA MULTIPLE INDEXED COLUMNS 51
CLIENT (USED INDEX COLUMN)
EXTRACTKEY (USED INDEX COLUMN)
T_02 ZDOE00G03X00~EKI JOIN VIA MULTIPLE INDEXED COLUMNS 237
CLIENT (USED INDEX COLUMN)
EXTRACTKEY (USED INDEX COLUMN)
NO TEMPORARY RESULTS CREATED
RESULT IS COPIED , COSTVALUE IS 2
SHOW QUERYREWRITE : APPLIED RULES:
SHOW DistinctPushDown 1
SHOW PushDownPredicates 1
Explain End
This is the explain after the update statistics with 20000 records in the table RR00K00G03X_DQ.
Count of the tables:
SQL Statement
SELECT
DISTINCT T_01 . "C5" "EXTRACTKEY" , T_00 . "DEVID" "DEVID"
FROM
"RR00K00G03X_DQ" T_00 INNER JOIN "ZDOE00G03702" T_01 ON T_01 . "CLIENT" = ? AND T_01 . "EXTRACTKEY
" = T_00 . "INSID" INNER JOIN "ZDOE00G03X00" T_02 ON T_02 . "CLIENT" = ? AND T_02 . "EXTRACTKEY" =
T_01 . "C5"
WHERE
T_00 . "CLIENT" = ? AND T_00 . "SEQNO" IN ( ? , ? , ? , ? , ? )
Execution Plan
OWNER TABLENAME COLUMN OR INDEX STRATEGY PAGECOUNT
T_00 RANGE CONDITION FOR KEY 564
CLIENT (USED KEY COLUMN)
SEQNO (USED KEY COLUMN)
T_01 ZDOE00G03702~EKI JOIN VIA MULTIPLE INDEXED COLUMNS 51
CLIENT (USED INDEX COLUMN)
EXTRACTKEY (USED INDEX COLUMN)
T_02 ZDOE00G03X00~EKI JOIN VIA MULTIPLE INDEXED COLUMNS 237
CLIENT (USED INDEX COLUMN)
EXTRACTKEY (USED INDEX COLUMN)
NO TEMPORARY RESULTS CREATED
RESULT IS COPIED , COSTVALUE IS 2
SHOW QUERYREWRITE : APPLIED RULES:
SHOW DistinctPushDown 1
SHOW PushDownPredicates 1
Explain End