Super Slow Single Table...Weird Issue

Steve
Member Posts: 81
I'm helping out a friend with a weird issue.
There customer table is super slow. I wrote a simple findset repeat and update a single field on the customer table from a lookup using a codeunit just to test. as shown:
IF Cust.FINDSET THEN
REPEAT
IF PayTerm.GET(Cust."Payment Terms Code") THEN
BEGIN
Cust.VALIDATE("Payment Method Code", PayTerm."Payment Method Code");
Cust.MODIFY;
END;
Window.UPDATE(1, Cust."No.");
UNTIL Cust.NEXT=0;
We timed the window updates and its easily 1.75-2.25 seconds per update and the process takes hours.
Important stuff
- Customer table 40k records
- Nav 2009sp1
- Other tables respond "with normal speed"
- Sql 2008
32gig mem
logs - striped across 4 drives
db - striped across 8 drives
Sql DB's seperate 4 drives
Same speed with out without other users
There customer table is super slow. I wrote a simple findset repeat and update a single field on the customer table from a lookup using a codeunit just to test. as shown:
IF Cust.FINDSET THEN
REPEAT
IF PayTerm.GET(Cust."Payment Terms Code") THEN
BEGIN
Cust.VALIDATE("Payment Method Code", PayTerm."Payment Method Code");
Cust.MODIFY;
END;
Window.UPDATE(1, Cust."No.");
UNTIL Cust.NEXT=0;
We timed the window updates and its easily 1.75-2.25 seconds per update and the process takes hours.
Important stuff
- Customer table 40k records
- Nav 2009sp1
- Other tables respond "with normal speed"
- Sql 2008
32gig mem
logs - striped across 4 drives
db - striped across 8 drives
Sql DB's seperate 4 drives
Same speed with out without other users
Steve
0
Comments
-
The first thing I notice is you are updating a record retrieved with a default FINDSET. Which is a FINDSET(FALSE, FALSE). You should use a FINDSET(TRUE) when you intend to update. With a large table like this you'd probably be better with a FIND('-')There are no bugs - only undocumented features.0
-
The other thing to check is what code you have in the OnValidate trigger of the "Payment Method Code" field - it could be this that is taking up the time.0
-
Why not to investigate with Client Monitor? At least you can exclude bad keys and ugly code after running client monitor...0
-
Try this:
PayTerm.RESET; IF PayTerm.FINDSET THEN REPEAT PayTermTemp := PayTerm; // use a temptable for the payment terms PayTermTemp.INSERT(FALSE); UNTIL PayTerm.NEXT = 0; IF Cust.FINDSET(TRUE,TRUE) THEN REPEAT IF PayTermTemp.GET(Cust."Payment Terms Code") THEN BEGIN IF Cust2.Payment Method Code" <> PayTermTemp."Payment Method Code" THEN BEGIN // why modifying the table if it is already ok? Cust2 := Cust; // best use another buffer to do your dirty work. Cust2.VALIDATE("Payment Method Code", PayTermTemp."Payment Method Code"); Cust2.MODIFY(FALSE); END; END; // DO NOT USE UPDATE HERE! Window.UPDATE(1, Cust."No."); UNTIL Cust.NEXT = 0;
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Solved, but raised a new question.
I found a line of code that was a add-on piece of code which checks user field level permissions. So i commented that out and the process flies.
The issue that it raised is why is testing the windows access control table so slow?
Filters are roleid , userid
When you open the table its not slow, but a simple query runs slow.
***Could "maybe a slow Active Directory" slow down virtual tables?Steve0 -
Could you post the code you removed? I use the "allow this only is member of role X" stuff in many situations and have never experienced a performance issue. That's not to say I just haven't run into one yet. But maybe we'll spot something.There are no bugs - only undocumented features.0
-
If I remember correctly, the user name in the table is a flowfield and the security check is on that table, so it is slower.
And if you do that for (each field in) each record, it adds up.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Change the code so that it tests an "Allow editing customers" checkmark you create in the User Setup. Frankly the whole roles and permissions stuff is such a mess, so I rather I start with everybody being SUPER(DATA) restricted on the MenuSuite only, and when and if people go "Gaah! Leslie changed a Credit Limit to sixty billion! Can you stop him doing so?" then I add a boolean to the User Setup and a very simple short code whole thing is 5 mins.0
-
Steve wrote:Solved, but raised a new question.
I found a line of code that was a add-on piece of code which checks user field level permissions. So i commented that out and the process flies.
The issue that it raised is why is testing the windows access control table so slow?
Filters are roleid , userid
When you open the table its not slow, but a simple query runs slow.
***Could "maybe a slow Active Directory" slow down virtual tables?
You can cache access rights. Simple implementation looks like:
1. Create single instance codeunit Security Management.
2. Inside the codeunit create a boolean variable IsInited and a function InitCodeunit - copy every data that you need into temporary tables.
3. Transfer all security checks into the codeunit functions.Looking for part-time work.
Nav, T-SQL.0 -
Good approach, only one thing - admins should be aware of this customization. Normally when you change security setting for an user the changes come to play immediately, but with single instance cashing codeunit the changes will be applied only after restart of client.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