Slow search

Working with NAV 2009.

I have a query on Item ledger entry which is slow.
It seems, that the first 2 iterations take a lot of time (about 1 minute), but after that it is fast (within the second).
The code I use:

ILE.RESET;
ILE.SETRANGE(ILE."Item No.", "Item No.");
ILE.SETRANGE(ILE.Open, TRUE);

ILE.SETCURRENTKEY("Item No.",Open,"Variant Code","Location Code","Item Tracking","Lot No.","Serial No.");

IF ILE.FINDSET
THEN REPEAT
<create temp table records>
UNTIL (ILE.NEXT = 0);

When I close the program and reopen it there is no delay. But when Navision is closed and reopened the same problems pops up.

Best Answers

Answers

  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    How many entries do you have in your Item Ledger Entry?
    How many enties, on average, are you expecting to copy to temp table in your loop?
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • AdriAdri Member Posts: 8
    about 4.5 milion
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    Are you on SQL or Native?
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • AdriAdri Member Posts: 8
    SQL
  • AdriAdri Member Posts: 8
    Thank you for your help!
Sign In or Register to comment.