Add BC performance knowledge from OptimAL learnings

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Jesper Schulz-Wedde 2026-09-25 14:13:37 +02:00
parent 07e324ddbc
commit af94c135ad
37 changed files with 881 additions and 36 deletions

View file

@ -1,15 +1,14 @@
codeunit 50223 "Perf Sample CalcSums Bad"
{
procedure TotalRemaining(CustomerNo: Code[20]) Total: Decimal
procedure TotalSales(CustomerNo: Code[20]) Total: Decimal
var
CustLedgerEntry: Record "Cust. Ledger Entry";
begin
CustLedgerEntry.SetCurrentKey("Customer No.");
CustLedgerEntry.SetRange("Customer No.", CustomerNo);
// One SQL query per row over a 10M-row ledger.
if CustLedgerEntry.FindSet() then
repeat
CustLedgerEntry.CalcFields("Remaining Amount");
Total += CustLedgerEntry."Remaining Amount";
Total += CustLedgerEntry."Sales (LCY)";
until CustLedgerEntry.Next() = 0;
end;
}