mibuso.com

Microsoft Business Solutions online community
It is currently Sat May 25, 2013 2:08 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Update Analysis View slow after upgrade to SQL 2005
PostPosted: Fri Mar 16, 2012 3:34 pm 
Offline

Joined: Mon Jan 24, 2011 5:47 pm
Posts: 6
Country: United Kingdom (uk)
Hi All,

I have an interesting problem. ](*,) Our customer upgraded their NAV 5.0 SP1 to run on SQL 2005 instead of SQL 2000. Every month they post 6000 invoices which use to take 26 minutes and now it takes days. The problem is that after every invoice is posted an analysis view is update - standard NAV code. For now they have switched the auto update off. The G/L Entry table contains 13,318,238 entries. I know it is not best practice to have the Auto Update switched on.

The following line of code takes 30 seconds to run on SQL 2005 (also SQL 2008 with NAV 2009 R2 client) but milliseconds on SQL 2000: Codeunit 410 (Update Analysis View) - Function - Update Entries

UNTIL (GLEntry.NEXT = 0) OR (LedgEntryDimEntryNo = 0);

The actual line that I think that is causing the problem is the line before:
GLEntry.SETRANGE("Entry No.",LedgEntryDimEntryNo,MaxNumber);

SQL code that NAV code runs:
SELECT * FROM "SQL 2005 Test$G_L Entry" WITH (UPDLOCK) WHERE (("Entry No_">=0 AND "Entry No_"<=2147483647)) AND (("G_L Account No_">='2000' AND "G_L Account No_"<='9999') AND ("G_L Account No_"<>'')) AND "Entry No_">13334454 ORDER BY "Entry No_"

If I run the above SQL Code in SQL directly it is fast.

The three databases reside on the same hardware with the same memory allocated and optimisation ran.

If I create a G/L Account key on the G/L Entry table in NAV it makes no difference. If I create a non-clustered non-unique SQL Index on the G/L Entry table with the Entry No. as an Indexed Key column and add the G/L Account No. as an Included Column the posting reduces to 2 seconds. Still slower than SQL 2000 but much faster than 30 seconds.

I cannot get a NAV key to create a SQL Key as above i.e. can't get NAV to create an Include Column key. Don't want to create the key in SQL because the NAV backup won't include it.

Questions:
- Why is it slower on SQL 2005 and SQL 2008.
- Any ideas to make it faster other than rewrite the standard NAV code.

Thank you all.
Regards


Top
 Profile E-mail  
 
 Post subject: Re: Update Analysis View slow after upgrade to SQL 2005
PostPosted: Fri Mar 16, 2012 5:24 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Aug 14, 2001 7:01 am
Posts: 5315
Location: Prague
Country: Czech Republic (cz)
Are these old objects (3.7 or 4.0)?

_________________
David Singleton
Dynamics NAV Freelancer
Dynamics Book
Go-Live International


Top
 Profile E-mail WWW  
 
 Post subject: Re: Update Analysis View slow after upgrade to SQL 2005
PostPosted: Fri Mar 16, 2012 6:45 pm 
Offline

Joined: Mon Jan 24, 2011 5:47 pm
Posts: 6
Country: United Kingdom (uk)
5.0 SP1 Objects. Checked and the object is the same in NAV2009.

Thanks


Top
 Profile E-mail  
 
 Post subject: Re: Update Analysis View slow after upgrade to SQL 2005
PostPosted: Fri Mar 16, 2012 7:55 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Aug 14, 2001 7:01 am
Posts: 5315
Location: Prague
Country: Czech Republic (cz)
Then just fix the code.

_________________
David Singleton
Dynamics NAV Freelancer
Dynamics Book
Go-Live International


Top
 Profile E-mail WWW  
 
 Post subject: Re: Update Analysis View slow after upgrade to SQL 2005
PostPosted: Mon Mar 19, 2012 11:11 am 
Offline

Joined: Mon Jan 24, 2011 5:47 pm
Posts: 6
Country: United Kingdom (uk)
Thanks but I would like to understand why.


Top
 Profile E-mail  
 
 Post subject: Re: Update Analysis View slow after upgrade to SQL 2005
PostPosted: Mon Mar 19, 2012 11:41 am 
Offline
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Tue Jul 19, 2005 4:49 pm
Posts: 3849
Location: Olst
Country: Netherlands (nl)
There are loads of posts on the forum about the differences between SQL2000 and newer versions.

If you are running on SQL2005 it is very important to have all the latest servicepacks and hotfixes for both NAV and SQL. SQL2005 was, when it was released, the worst combination ever with NAV.

Can't you upgrade directly to SQL2008?

_________________
Mark Brummel | Freelance Dynamics NAV (Navision) Developer
Author of the book : Microsoft Dynamics NAV 2009 Application Design

MY BLOG : http://www.brummelds.com


Top
 Profile E-mail WWW  
 
 Post subject: Re: Update Analysis View slow after upgrade to SQL 2005
PostPosted: Mon Mar 19, 2012 1:36 pm 
Offline

Joined: Mon Jan 24, 2011 5:47 pm
Posts: 6
Country: United Kingdom (uk)
Thanks but already upgraded to NAV2009R2 client and SQL2008 and same issue. Code is the same between 5.0 SP1 and NAV2009 so no point in upgrading code.


Top
 Profile E-mail  
 
 Post subject: Re: Update Analysis View slow after upgrade to SQL 2005
PostPosted: Fri Nov 30, 2012 12:16 pm 
Offline

Joined: Fri Sep 08, 2006 8:42 am
Posts: 4
Location: Zlin
Country: Czech Republic (cz)
I tested posting yesterday, because we had some problems about blocked users and slow posting some invoices. Finally the code in CU410 is horrible in replacing WHERE clause for SQL query "on-fly".

This lines:
Code: Select all
  IF LedgEntryDimEntryNo < MaxNumber THEN
    GLEntry.SETRANGE("Entry No.",LedgEntryDimEntryNo,MaxNumber);
caused changing range to 0..MaxNumber, so all G/L Entries match on GLEntry.NEXT = 0

To solve use this: http://www.mibuso.com/forum/viewtopic.php?p=270695#p270695

_________________
Jan Esterka
NAV Freelancer
LUKROM Holding
Profile


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: