|
Hello guys
An SQL question, I hope this is the right form
adding a field (NMDSTTYP) to a 50M records DWH file I pondered what is a
better way to populate this new field:
By a RPG-Chain-like way using a subselct
update DWHD.RTDACTBF_R a
set NMDSTTYP = (select DSTTYP from NMLIBD.NMCOMPNYF b
where b.COMPNY = a.COMPNY)
Or
By doing a MERG with a When Matched clause
(imitating MS SQL Server Update from) :
MERGE INTO DWHD.RTDACTBF_R a
USING NMLIBD.NMCOMPNYF b on b.COMPNY = a.COMPNY
WHEN MATCHED THEN
UPDATE SET a.NMDSTTYP =b.DSTTYP
I figured the 2nd way is better as it should do a one time join
compared to the 1st way that does (well, I don't quite know what it does)
both SQL statements were submitted to batch using SBMJOB RUNSQL with
COMMIT(*NONE)
The 1st RPG-Chain-like Update took 10 minutes
The 2nd MERG Update took 4 hours
anybody care to explain?
Thanks
Gad
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.