Customer.GET slow

mariusswart
Member Posts: 1
Can someone perhaps cast some light on why this simple Customer.GET could be slow - more than 500 ms?
NAV2009 classic, SQL Server.
Code is in Sales Header table
function: GetCust
IF NOT (("Document Type" = "Document Type"::Quote) AND (CustNo = '')) THEN BEGIN
IF CustNo <> Cust."No." THEN
Cust.GET(CustNo);
SQL:
SELECT "timestamp","No_","Name","Search Name","Name 2","Address","Address 2","City","Contact","Phone No_","Telex No_","Our Account No_","Territory Code","Global Dimension 1 Code","Global Dimension 2 Code","Chain Name","Budgeted Amount","Credit Limit
NAV2009 classic, SQL Server.
Code is in Sales Header table
function: GetCust
IF NOT (("Document Type" = "Document Type"::Quote) AND (CustNo = '')) THEN BEGIN
IF CustNo <> Cust."No." THEN
Cust.GET(CustNo);
SQL:
SELECT "timestamp","No_","Name","Search Name","Name 2","Address","Address 2","City","Contact","Phone No_","Telex No_","Our Account No_","Territory Code","Global Dimension 1 Code","Global Dimension 2 Code","Chain Name","Budgeted Amount","Credit Limit
0
Answers
-
It could be because your SQL Indices are not up-to-date or messed up, so SQL must do a table scan instead of an index seek. Are you recurrently maintaining all indices?
you can monitor the sql statement with management studio (exceution plan) to see what happens in real.0 -
Are you sure this is the code that is actually slow and not something before/after?
Have you tried running this code in isolation like on a Form.OnOpen with a hardcoded customer number?
Which version of SQL server do you have? Using a setcurrentkey will not do anything in this case.0 -
Yup, it was just a doublecheck because...well...a slow GET it's a weird problem, and you need to do weird questions to get around it0 -
Some things to check:
-Is there a blob in the customer table? Just the existence of a blob field in it can slow the select down. If the blob field is not used, change the datatype to boolean. Did that once for a customer and the performance increase was stellar...
-Are you doing regular index rebuilds?
-Is it always slow or just sometimes?
-Do you have a MODIFY/INSERT/DELETE on the customer table in the same transaction? This means that the GET becomes a SELECT ... EXCLUSIVE LOCK. This might take longer for locking the record.
-Copy the select statement to SSMS and run it using the actual execution plan. and also doingset statistics io on; set statistics time on; your select; set statistics io off; set statistics time off;
And post it in this topic so we can check it out. Be sure to get a select that is slow and not one that is fast.
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!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