We runnning this code from our ERP application Dynamics AX 2012 R3 CU10, which is part of the upgrade process from AX 4.
ttsbegin;
while select forupdate salesLine
where salesLine.RemainSalesFinancial != 0
&& salesLine.RemainInventFinancial == 0
{
salesLine.RemainInventFinancial = 0;
select sum(Qty) from inventTrans
where inventTrans.del_InventTransId == salesLine.InventTransId
&&(inventTrans.StatusIssue == StatusIssue::Deducted
|| inventTrans.StatusReceipt == StatusReceipt::Received);
salesLine.RemainInventFinancial = -inventTrans.Qty;
salesLine.doUpdate();
}
ttscommit;
The thing is that we ran this process for 2 installations. In the first installation the entire procedure took 45 minutes to execute, however, on the second one it takes 24 hours.
I'm trying to find out where is the performance issue. This are my observations:
- SalesLine number of rows is practically the same (8 million rows)
- InventTrans is 4 times greater in the second installation (40 million vs 10 million) I don't think this should account for such a difference in execution time. I've created an index in this table, so the sum(qty) is smooth. Duration 0 in SQL Profiler
- On SQL server side, the first installation has SQL Server 2008 Enterprise vs the second installation SQL Server 2014 Standard. Both 64 bit edition. Does Standard edition have any type of limitation that could cause this?
- CPU is the same: 2 CPUs of 4 core each. Total 8 cores with 2,4 Ghz
- Memory is 64 GB RAM in the second installation vs 32GB on the first one, so the problem cannot be here
- Configuration in SQL server is the same. Splitted tempdb in 8 files os 10GB each. Max degree of paralelism set to 4 in both servers
- Max memory ussage is set to 56 GB in the second server, 24 in the first one.
- Other difference I see is that Application server (AOS) has only one CPU core in the second installation and in the first one it has 4, but I understand that AOS doesn't do much processing anyway.
- OS is Windows 2012 R2 Standard 64bit in second installation. Windows 2008 R2 Datacenter 64bit in the first one
I'm not sure if OS o SQL server edition can have such an impact in execution time. I need to make sure this is the issue before ordering a software or OS change.
I don't know what else to check. Any ideas?
In case anyone wants to have a look, the code is in class.method: ReleaseUpdateDB401_Cust.updateSalesLineRemainInventFinancial
RemainSalesFinancial != 0 && RemainInventFinancial == 0. Since this is a.doUpdate()which doesn't call any business logic, you could do this update directly in SQL. - Alex Kwitnyatomicprocess. - Alex KwitnyinventTrans.del_InventTransId. The.del_indicates it's a field marked for deletion after the upgrade. If this field has data populated, you can probably be safe to do this in SQL if needed.InventTransIdis normalized and moved to a new tableInventTransOriginfromInventTransand is referenced byRecIdin AX12. Ordel_InventTransIdcould be a renamed field fromInventTransIdor it could just be a new column populated from another column on the same table. - Alex Kwitnyupdate_recordset. Remember to callskipDateMethods(true)first. - Jan B. Kjeldsen