I have reviewed some of the previous posts about autoincrement. Also asked a Microsoft employee about it. His comment is the current locktable method will stay as long as there is a native database.
Jörg A. Stryk wrote that he had implemented autoincrement, but added GUID as the clustered index to avoid locking problems.
One question I have about this method, don't you end up with frequent page splits if you use this method, which you will never have with a clustered index based on entry no.? Do you start out with a low fill factor on the ledger tables to reduce the occurence?
Has anyome been running at least several months on a high transaction database using autoincrement and is stilkl happy with it?
0
Comments
Well, with the appropriate Fillfactor you won't get that many Page Splits, but probably more than with the "Entry No." CI. Of course, a GUID (16 bytes) index is remarkably larger than an integer (4 bytes) index, and the FF needs to be lower than 100% - hence, a GUID index is larger and forcing "physical disorder". The performance when Reading may be worse, too. The GUID thing is inteded to prevent blocking issues only.
That's what I tried to point out during my presentation (and in my BLOG): It always depends! It's all a matter of balance! There is no "silver bullet" to fix things, every solution has advantages and disadvantages ... that's what makes troublshooting such a "tricky business" ...
You really have to test this first. And have in mind: DON'T DO IT ON FISCALLY RELEVANT TABLES like G/L Entry, VAT Entry, Value Entry, Customer Ledger Entry, etc.!
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool
I just tried it to be sure.
I created a table with 2 fields in it : the clustered index (an integer) that is autoincrementing and a session ID in which I save the sessionID of the session.
I launched 2 clients to insert 10000 records in it in 1 transaction. Then I checked the records and I saw that the session-ID's alternate between the 2 sessions!
The GUID is another way to avoid the locking, but has some extra problems:
-it is BIG in confront with an integer (or even a biginteger).
-it can create a lot of pagesplits in the database, depending on the fillfactor on the index on it.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Yes, but still you need to have on mind, that when posting, you need to lock the table to prevent others to change the data during your posting, else you can have inconsistent database (e.g. when used with Item Ledger Entry).
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
http://mibuso.com/blogs/davidmachanick/
Because if you read some data to e.g. calc sum, and you create new entry based on this sum, and some other process will read same set of record, calc the sum and create another record, you will have two records based on same data but together giving you wrong result... ;-) it is why LockTable is used for - to prevent changes of record set you have read....
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
http://mibuso.com/blogs/davidmachanick/
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
As long as the commit is done after all the ledger rows have been inserted, wouldn't that keep the entries correct and consistent?
http://mibuso.com/blogs/davidmachanick/