RecordRef performance issue.

aljosagr
Member Posts: 5
Hi guys,
I have a strange problem while using RedordRef in a function to copy data from one company to another. The problem is that the function exponentionally slows down.
I know that the solution will be not to use RecordRef but i need it done in this way. The issue become visible when there are 20.000 records and more in the table.
Does anybody have an idea how to solve this issue?
Thanks in advance for any suggestions,
I have a strange problem while using RedordRef in a function to copy data from one company to another. The problem is that the function exponentionally slows down.
I know that the solution will be not to use RecordRef but i need it done in this way. The issue become visible when there are 20.000 records and more in the table.
Window.OPEN('Progress\@1@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'); TableID := DATABASE::"G/L Entry"; FromRecRef.OPEN(TableID,FALSE,'COMPANY1'); ToRecRef.OPEN(TableID,FALSE,'COMPANY2'); AllEntries := FromRecRef.COUNT; CurrEntry := 0; IF NOT FromRecRef.FIND('-') THEN EXIT; FieldsCount := FromRecRef.FIELDCOUNT; REPEAT CurrEntry += 1; PercentDone := CurrEntry / AllEntries; PercentDone *= 10000; Window.UPDATE(1,ROUND(PercentDone,1)); ToRecRef.INIT; FOR CurrFieldIndex := 1 TO FieldsCount DO BEGIN FromFieldRef := FromRecRef.FIELDINDEX(CurrFieldIndex); ToFieldRef := ToRecRef.FIELDINDEX(CurrFieldIndex); ToFieldRef.VALUE := FromFieldRef.VALUE; END; ToRecRef.INSERT; UNTIL FromRecRef.NEXT=0; Window.CLOSE;
Does anybody have an idea how to solve this issue?
Thanks in advance for any suggestions,
0
Comments
-
what is the memory usage during the process for the cleint?
Also have you tried and used newer version of the client to compare the performance.
I'm guessing you are comparing it to a record variable.
What is the time difference betwen recordref and record for 20K records?0 -
after the OPEN commands try:
FromRecRef.SETVIEW;
ToRecRef.SETVIEW;
and in your loop try:
ToRecRef.FIELDINDEX(CurrFieldIndex).VALUE := FromRecRef.FIELDINDEX(CurrFieldIndex).VALUE0 -
As I can see you are using COUNT and assign it to a variable which is used only for updating progress bar.
So my recommendation here is to use COUNTAPPROX instead of COUNT. It should speed up the process.
Also you can move this calculation below the exit criteria check. The code will look like this:
IF NOT FromRecRef.FIND('-') THEN
EXIT;
AllEntries := FromRecRef.COUNTAPPROX;
CurrEntry := 0;0 -
The count is called only once. The performance difference is between using record and recordRef.0
-
Do not forget that commiting the data after some count of inserted records can speed the thing up. But of course only if you can split the transfer into separate transactions. For big count of insert the transaction grows up and it can be the source of problems...0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions