Quantcast
Viewing all articles
Browse latest Browse all 72043

SQL Blocking when batch job is run in parallel in multiple legal entities

Hello,

So we have a requirement to delete inactive addresses from LogisticsPostalAddress table ,based on some parameter values,

But when i'm trying to run this batch job in multiple companies in parallel , it is causing blocking 

I want to run it in parallel to reduce the time taken by batch job to finish , as of now it is set to run in dependency 

Below is the sample code  

select firstonly RecId from logisticsLocationRole where logisticsLocationRole.Type == _dataContract.parmAddressPurpose();

while select validTimeState(validFromDT, validToDT) ValidTo, Location from logisticsPostalAddressLoc
where logisticsPostalAddressLoc.ValidTo != DateTimeUtil::maxValue()
join logisticsLocation index hint cnlRecIdDescIdx where logisticsLocation.Description == _dataContract.parmAddressName()
&& logisticsLocation.RecId == logisticsPostalAddressLoc.Location
join Location, IsPrimary, party, RecId from dirPartyLocation where dirPartyLocation.Location == logisticsLocation.RecId
&& dirPartyLocation.IsPrimary == NoYes::No
exists join custTable where custTable.party == dirPartyLocation.party
exists join dirPartyLocationRole where dirPartyLocationRole.PartyLocation == dirPartyLocation.RecId
&& dirPartyLocationRole.LocationRole == logisticsLocationRole.RecId

{
ttsBegin;
logisticsLocation.selectForUpdate(true);
if(logisticsLocation.validateDelete())
{
logisticsLocation.delete();
totalAddresssesDeleted++;
}
ttsCommit;


Viewing all articles
Browse latest Browse all 72043

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>