Hello Gurus
We moved to sql for our navision 5 months ago. I generally hear that Navision-SQL is little bit slower than the regular native database. Users are reporting that the system is getting day by day slower.
I have a good amount of knowledge in moving around in SQL enterprise manager. Could anyone guide me through some basic sql database maintenance steps or share some knowledge why navision is slow.
MP
0
Comments
1) Index maintenance -- weekly for heavily used tables -- some run it daily... Arguments break out on the forums (? fora ?) about whether using the NaviSql client/db info/tables/optimize is better, or just set up a db maint plan to run automatically... just do something (actually, you really need to do both -- schedule maint. plan frequently; then manually optimize after every full restore, and periodically, say monthly)...
2) Split the 'secondary' db file into multiple files, spread across spindles if possible... this takes a full backup/restore/optimize cycle to gain the benefits, but is is worth it... Hard to say how many files -- depends on your hd config...
3) Don't rely on auto-grow -- it always happens at a lousy time (when the db is the most busy) -- and it is non-optimal: it only grows one file of many, causing that file to become 'hot' -- all new records go into one file... So, watch your file free space (at least weekly), and manually grow the files before they fill up.
4) If you restart the SQL Server service periodically, be sure to define the initial size of the Transaction Log correctly (read: make it pretty big). A tx log auto-grow is sure to piss off a whole bunch of people because things are guaranteed to be locked up for just about everyone when/if this happens...
And that's just to get you started...!
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Thanks for the posts..Will post back later reg my findings.
MP
Changing your recovery mode to simple means you cannot recover to a point in time, you have to go back to previous backup.
http://mibuso.com/blogs/davidmachanick/
So in a lot of tables, you can remove (=MaintainSQLIndex:No) some indexes that SQL will not use.
And even if you put SETCURRENTKEY in Navision, SQL translates it to ORDER BY. The index that is used wil be decided by SQL-server when the command is run.
Some guidelines:
-In general SQL uses the smallest indexes first.
-If SQL has to scan 2000-3000 records to select some records or do a SUM(...), you don't need an extra index for that. This goes very fast.
-Don't maintain all levels of the SIFT, just the ones you really need.
An example on Table 21 Navision 3.70B W1: (I didn't take the disabled keys)
-Entry No. : primary key, you need this one.
-Customer No.,Posting Date,Currency Code Sales (LCY),Profit (LCY),Inv. Discount (LCY) : if you have a lot of customers with a few 1000 of entries, don't maintain the index, nor the SIFT. BUT create a new key with just 1 field in it:"Customer No.".
-Document No.,Document Type,Customer No. : this key is to big. Or SQL uses an index on "Document No." or "Customer No.". Don't maintain this Index. BUT create an index on "Document No.".
-Document Type,External Document No.,Customer No. : this index is stupid, it should NOT start with an option, but it should start with "External Document No.". So don't maintain it, BUT create a new index "External Document No.".
-Customer No.,Open,Positive,Due Date,Currency Code : we already have an index "Customer No.", so no need to maintain it.
-Open,Due Date:this index is better maintained. In general indexes starting with a boolean are not good, but this one is because this index is used to get the open entries, and only a small part of the entries will be open.
-Document Type,Customer No.,Posting Date,Currency Code Sales (LCY),Profit (LCY),Inv. Discount (LCY): "Document Type" is an option, so it is a bad idea to start an index with it. Don't maintain the index nor the SIFT, we already have an index with "Customer No."
-Salesperson Code,Posting Date: Best maintain this index.
-Closed by Entry No.: Best maintain this index.
-Transaction No.: Best maintain this index.
-Customer No.,Applies-to ID,Open,Positive,Due Date: we have a smaller index with "Customer No.", so don't maintain this one.
New Indexes:
-"Customer No."
-"Document No.". This index is always very good, because with a certain document no, SQL has only to scan 1 or just a few records!!!!
-"External Document No."
Conclusion:
-We don't maintain 6 indexes.
-We have 3 new indexes, but very small ones, so faster to maintain.
=> we gain a lot of writing speed but losing very little reading speed.
Afterthought:
If we have few customers, but lots of entries per customer, we might create 2 indexes, 1 with "Customer No."+"Posting Date" and 1 with "Customer No."+"Open".
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
My transaction file is in a separate disk.
kirki - you have posted lot of information. Thanks. I am not a Navision person. I am the IT guy here and support is handled thru the Navision Support Center folks. I will pass your post to them to see if they can provide some help.
current status is I have asked my Support center guys to look at it. They looked at the Navision Tables and said everything is normal. They are planning to turn on the performance monitor and watch the activity and load. I am not sure whether this is going to help or not.
The problem is that these sift tables are maintained when records are inserted, deleted, modified, etc. Even though the owning table is under a record level lock, once the sift maintenance starts, you can get into table level locking for the key table. This can really hurt performance.
Setting up the SIFT indexes appropriately is very important in a high volume environment. Since SQL is capable of running without them (flow field calculations will be slower but will still calculate).
These can be a little tricky to figure out, but here's a simple way to quickly identify if this has anything to do with your issues.
Make a copy of the database and disable all sift indexes on the tables involved. Most commonly this will be in the sales order processing and posting areas.
Try turning off sift maintentance for all keys in the following tables:
Item Ledger Entry
Value Entry
Reservation Etnry
G/L Entry
Vendor Ledger Entry
Detailed Vendor Ledger Entry
Customer Ledger Entry
Detailed Customer Ledger Entry
Analysis View Entry
Sales Line
Sales Invoice Line
Things will run significantly faster or not, but it is quick to do and if it changes things, you have somewhere to go.
It looks like I can't add attachments here or I'd attach a little utility that you can use as well.
If you are interested, send me your email address and I'll forward you a 3.7 version of this object.
It contains a form and table called Performance Buffer. Run whatever activity that you are interested in and turn on the client monitor from within Navision (You may need help from your solution center to get a more powerful license if yours does not support this). Then run the performance buffer form. Select Load Buffer from the functions menu.
This will use the temporary performance buffer table to summarize the client monitor information into source object, function, table data and will give you an elapsed time for what is going on broken down by the object, function and accessed table. It will give you an idea of where the system is spending its time. You can do use this before and after changing the sift fields to get objective results.
Good Luck! Joe.
I am also interested in that utility and I think also a lot of others.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
And why should he split the "second" db-file ?
Especially the second one is not quite clear to me ?!
If I had an array of disks (RAID 10), do you mean to split up the files on one disk or should one split up the array too ? And why ?
Thanks
RE: Trx log:
RE: Splitting db files:
* disk/array for system
* disk/array for data
* disk/array for tx logs
what aboud temp db and swap file - where to put those?
and does anyone have a good recommendation table for cpu #/memory depending on users (say, 50, 100 users?)
Have you made some C/AL code optimization? Or it was just migration from one platform to another?
thx
Best Regards
Hi, Kriki
I'm still a beginner in this Navision world :P
Your post is very useful information for me..
I want to ask you. In your post, if you said not to maintain the index, is it mean turn off the MaintainSQLIndex? And if you said not to maintain the SIFT, is it mean turn off the MaintainSIFTIndex?
Thank you
Best Regards,
Johanna
Johanna
But an extra note is needed now:
In older versions it wasn't a problem not maintaining those 'bad' indexes or changing the SQLINdex-property and getting better performance.
With the newer versions, NAV is using the SQL-cursors a little different and doing not maintaining can now trigger a clustered index scan on the table (worse than this is not possible).
So be careful about doing this : each time you do this, you should check if it helps performance.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Which versions are included in the older versions?
Which versions are included in the newer versions?
Johanna
newer : 50SP1+
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
You know like the old versions where the query optimisers were actually predictable.
TVision Technology Ltd
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool
How about your advice & R2 release? I know what we can Cursors for Key now.
Yuriy Golyachuk, NAV Solutions Specialist & Developer
Skype: RedFoxUA
Should be:
older : <= 5.00
newer : >= 50SP1+
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool
Except that it isn't version dependent, its Hotfix dependent, so you need to look at Waldo's blog. You can get versions of 4 and 5 with Dynamic Cursors. 5.00 also have VSIFT now.
Keys: keys defined in NAV. They are needed for the SETCURRENTKEY in NAV.
Index: NAV Keys generally create an Index in SQL (you can avoid it with key-property MaintainSQLIndex=No). SQL doesn't care about the key NAV uses (not in a direct way that is). When a query arrives in SQL, SQL analyses it and decides which index is the best to get the data.
Cursors: NAV works on a record-per-record basis. But SQL hates that and wants to work set-based. To make SQL behave as a native-DB it uses cursors to fetch the records a record at the time (not completely true, but +- that is the idea). There are a lot of different cursors that can be used. The cursor-type used with older versions looked more at the WHERE-clause to decide the index to be used (and to make it even more complicated: it also changes with the build). The cursor-type used with newer versions look more at the ORDER BY clause (= the SETCURRENTKEY) to decide the index to be used. This last means that we cannot change the index-fields of a NAV-index like we did in the old days. Doing that now has often the effect that the clustered index (=the whole table) is scanned for the records needed with very bad performance as a result.
2009 R2 is a good version, especially with a good recent build and combined with SQL2008R2 64bit.
Out-of-the-box, it has good performance. With the older versions, performance-tuning was more necessary.
PS Joerg: "50SP1+" is the same as ">= 50SP1" (ok, it is not a NAV-filter )
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
- 5.0 SP1 R2 or 2009 SP1 R2
- SQL Views instead of Cursors
Yuriy Golyachuk, NAV Solutions Specialist & Developer
Skype: RedFoxUA