We have SAP HANA 1.0 SP11. We have one requirement where we need to calculate current stock at store, material level on daily basis. No of rows expected are around 250 million.
Currently we use procedure for same. Flow of procedure is as follows -
begin
t_rst = select * from <LOGIC of deriving current stock on tables MARD,MARC,MBEW>;
select count(*) into v_cnt from :t_rst;
v_loop = v_cnt/2500000;
FOR X in 0 .. v_loop DO
INSERT INTO CRRENT_STOCK_TABLE
SELECT * FROM :t_rst LIMIT 2500000 OFFSET :count;
COMMIT;
count := count + 2500000;
END FOR;
end;
Row count of result set t_rst is around 250 million.
Total execution time of procedure time is around 2.5 hours. Few times procedure goes into long running state resulting into error. We run this procedure in non peak hours of business so load on system is almost nothing.
Is there a way, we can load data in target table in parallel threads and reduce loading time. Also, is there way to bulk insert efficiently in HANA.
Query for t_rst fetches first 1000 rows in 5 minutes.
INSERT ...(SELECT ...))? Also, do you control the delta merge of the target table during your data load in any way?