点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)这是一个新话题,可以继续进行讨论...
点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)这是一个新话题,可以继续进行讨论...
加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)
这是一个新话题,可以继续进行讨论
当前需要在两个巨大的事实表之间进行联接。 如果在HANA上即时执行连接,则性能会降低,HANA有时会崩溃。
因此,存储过程将数据分块,然后对较小的分块执行联接,然后将结果转储到物理表中。 分块效率低下,但数据插入量甚至更多。 大部分时间花费在增量合并(数据插入)中。
这是代码
基本上,有两个表Table_A和Table_B,并从中创建一个分析视图。
我们从Table_A的分析视图中选择2个时间戳之间的数据
在一个循环中,我们联接来自Table_A和Table_B的数据
并将结果转储到物理表中。
可以做什么来优化。
不幸的是,我似乎无法像
那样将while循环的结果保存在内存中A =联合(while循环的结果)
创建过程CPM_SAP.SP_ZZFSL_CE11_REV_JOIN_V4
(在MIN_TIMESTAMP NVARCHAR(14)中,在MAX_TIMESTAMP NVARCHAR(14)中,在MIN_PERIOD NVARCHAR(6)中,在MAX_PERIOD NVARCHAR(6)中)
MIN_PERIOD;
XYEAR INT:= 0;
XMONTH INT:= 0; BEGINVAR_Z_NAME_OBSCURED =选择" RYEAR"," RTCUR"," RUNIT"," POPER"," RBUKRS"," RACCT"," RCNTR" ," RPRCTR"," RZZSITE"," RZZPOSID"," RZZFKBER"," DOCTY"," REFDOCNR"," AUFNR"," ZZLDGRP"," VBUND"," ZZBUZEI"," AWORG"," CPUDT" "," CPUTM",
" ZZBUZEI_RPOSN"," PERIOD_ID"," TIMESTAMP",
" TSL" AS" TSL"," HSL" AS" HSL"," KSL" AS" KSL"," MSL " AS" MSL"
FROM" _SYS_BIC"。" wlclose/AN_Z_NAME_OBSCURED_REV_KSLNN"
其中" TIMESTAMP">:MIN_TIMESTAMP和" TIMESTAMP" <=:MAX_TIMESTAMP; WHILE:XPERIOD <=:MAX_PERIOD DO VAR1_Z_NAME = ," RTCUR"," RUNIT"," POPER"," RBUKRS"," RACCT"," RCNTR"," RPRCTR"," RZZSITE"," RZZPOSID"," RZZFKBER"," DOCTY"," REFDOCNR"," AUFNR"," ZZLDGRP"," VBUND"," ZZBUZEI"," AWORG", " CPUDT"," CPUTM",
" ZZBUZEI_RPOSN"," PERIOD_ID"," TIMESTAMP",
" TSL" AS" TSL"," HSL" AS" HSL"," KSL" AS" KSL", " MSL" AS" MSL"
FROM:VAR_Z_NAME_OBSCURED
其中" PERIOD_ID" = CAST(:XPERIOD AS VARCHAR(6)); VAR_CE11000 =选择" PALEDGER"," KSTAR"," PERIOD_ID"," BUKRS"," COPA_AWORG"," ZZBUZEI_RPOSN"," RBELN"," PERIO",
" GJAHR"," PERDE"," RPOSN", " PRCTR"," PPRCTR"," SKOST"," RKAUFNR"," KURSF"," VV005_ME"," VV006_ME"," WW004"," WW011"," WW012"," WW013",
" WW008" ," WW023"," WW010"," WW020"," WW015"," WW006"," WW024"," WW026"," VV005" AS" VV005"," VV006" AS" VV006"来自" _SYS_BIC "。" wlclose/AN_CE11000_REV_LDG01"
其中" PERIOD_ID" = CAST(:XPERIOD AS VARCHAR(6)); VAR_JOIN =选择Z.RACCT AS RACCT,Z.RBUKRS AS RBUKRS,Z。" PERIOD_ID" AS ZPERIOD,Z 。" AWORG"作为AWORG,Z。" ZZBUZEI",Z。" REFDOCNR"作为REFDOCNR,Z。" RCNTR"作为RCNTR,Z。" RPRCTR"作为RPRCTR,Z。" RZZSITE"作为RZZSITE,Z。 " RZZPOSID" AS RZZPOSID,Z。" RZZFKBER" AS RZZFKBER,Z。" DOCTY" AS DOCTY,Z。" AUFNR" AS AUFNR,Z。" ZZLDGRP" AS ZZLDGRP,Z。" VBUND" AS VBUND,< br> Z。" TIMESTAMP"作为时间戳,Z。" RYEAR"作为RYEAR,Z。" POPER"作为POPER,Z。" TSL"作为TSL,Z。" HSL"作为HSL,Z。" RTCUR"作为RTCUR, Z." KSL" AS KSL,Z。" MSL" AS MSL,Z。" RUNIT" AS RUNIT,C。 " PALEDGER" AS PALEDGER,C。" KSTAR" AS KSTAR,C。" BUKRS" AS BUKRS,C。" PERIOD_ID" AS CPERIOD,C。" COPA_AWORG" AS COPA_AWORG,C。" RBELN" AS RBELN,C 。" ZZBUZEI_RPOSN" AS RPOSN,C。" WW004" AS WW004,C。" WW011" as WW011,C." WW012" AS WW012," WW013" AS WW013,C。" WW008" AS WW008,C. " WW023" AS WW023,C." WW010" AS WW010,C." WW020" AS WW020,C." WW015" AS WW015,C." WW006" AS WW006,C." VV005" AS VV005,C 。" VV005_ME" AS VV005_ME,C。" VV006" AS VV006,C." VV006_ME" AS VV006_ME
从:VAR1_Z_NAME_OBSCURED Z
左外连接:VAR_CE11000 C在Z." ZZBUZEI_RPOSN" = C。" ZZBUZEI_RPOSN"和
Z." REFDOCNR" = C。" RBELN"和
Z." AWORG" = C。" COPA_AWORG"和
Z." RBUKRS" = C。" BUKRS " AND
Z." PERIOD_ID" = C。" PERIOD_ID" AND
Z.RACCT = C.KSTAR;
插入CPM_SAP.ZZFSL_CE11_REV_JOIN(选择*来自:VAR_JOIN); XYEAR:=(:XPERIOD/100);
XMONTH:=:XPERI OD-(:XYEAR * 100); IF:XMONTH = 12XPERIOD时:=((:XYEAR + 1)* 100)+1;
ELSE
XPERIOD:=:XPERIOD +1 ;
END IF; END WHILE;
END;
是否还可以粘贴表DDL以及一些我们可能会爆炸的示例数据 进入一个大数据集? 桌子多大? 联接的性能如何以及该过程的时间安排?
这是HANA面临的一个相当典型的挑战。 一些评论:
-令我吃惊的是,不能使视图表现良好
-CE函数通常会提高此类代码的性能
-即便如此,如果有很多行,您的插入成本将是巨大的-您应该最多能够获得100万行/秒
-考虑按TIMESTAMP/PERIOD对目标表进行分区 这样您的MERGE DELTA不会影响已经存储的数据。 这将大大提高INSERT/MERGE DELTA的性能
-您需要嵌套SQLScript函数,以便SELECT语句中没有标量。 该代码将全部在单个线程中运行,这无济于事
John
一周热门 更多>