点击此处---> 群内免费提供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;
同意-
Rajarshi,如果您可以提供非常简化的方案版本,并且仅包含必需的逻辑,那么您很有可能会获得最有用的反馈。
SCN并不是按需代码审查的地方。 ????
我遇到这样的情况:一个表具有字段A,B,C,而另一个表具有C。C是最低的混合度(我想说层次结构中的叶子,但它并不总是严格的层次结构关系)。
在这种情况下,在SQLScript中,可以从表A创建A,B,C的中间表(考虑到HANA的列结构,这是高效的),将其连接到第二个表-UCV很容易。
通常我发现这种方法通常适用于乍一看使其看起来像是两个事实表之间的联接是唯一的选择的情况。
(自从我不得不写任何形式的证明以来已经很长时间了,但是有件事告诉我,一个人应该能够以数学方式证明,如果您要合并两个事实表,那么一个人可以只加入不同的维度 将每个表都放到某个中间表中,然后再将其连接到每个事实表中,然后再添加到UCV中。)
一周热门 更多>