Locking problems on sales line during invoice posting
Belias
Member Posts: 2,998
Hi guys, i have a big problem on nav 2009r2.
Once a month, the invoicing starts and a user starts to post invioces over and over (some of them counts 700ish lines!). During the sales invoice posting, other users receive errors about sales line being locked by another user.
Codeunit 80/90 obviously locks this table (for qty updates and so on), but i am wondering why everybody gets errors on a "random access table" like sales line. The database is set to Always rowlock, and my personal thought is that sql scales the lock all the way up to the table. Am i correct? is the only solution to post overnight in order to avoid locking problems?
Once a month, the invoicing starts and a user starts to post invioces over and over (some of them counts 700ish lines!). During the sales invoice posting, other users receive errors about sales line being locked by another user.
Codeunit 80/90 obviously locks this table (for qty updates and so on), but i am wondering why everybody gets errors on a "random access table" like sales line. The database is set to Always rowlock, and my personal thought is that sql scales the lock all the way up to the table. Am i correct? is the only solution to post overnight in order to avoid locking problems?
0
Best Answer
-
Hi Mirko,
let me guess.... lock escalation of the SQL Server? Sounds like you have a heavy load when these postings run. When there are too many (as always with SQL Server, try to quantify this) row locks on a table, the whole table is locked. There is a (really old) blog where this is mentioned, can't find it at the moment... but the Microsoft KB article describing this. With this, you could try to set up T-SQL scripts that run on Sales Line (and other tables where this may be a problem) and prevent the lock escalation as described in the KB. If this works, we would like to know
with best regards
Jens5
Answers
-
Hi Mirko,
let me guess.... lock escalation of the SQL Server? Sounds like you have a heavy load when these postings run. When there are too many (as always with SQL Server, try to quantify this) row locks on a table, the whole table is locked. There is a (really old) blog where this is mentioned, can't find it at the moment... but the Microsoft KB article describing this. With this, you could try to set up T-SQL scripts that run on Sales Line (and other tables where this may be a problem) and prevent the lock escalation as described in the KB. If this works, we would like to know
with best regards
Jens5 -
as i wrote in the original post, i had the feeling that the lock escalation was the problem...thanks for the kb, but the link shows me an empty page

NVM the link works...it's just my IE that is not getting it. LOL.0 -
Try to change transaction isolation level from Serializable to Repeatable read: http://forum.mibuso.com/discussion/45370/serializable-vs-repeatable-read.
If you use the Serializable isolation level SQL server always blocks a last line of previus order and a first line of next order (index range) to prevent phantoms during posting. If there are no next order lines then XXXXXXXX range will be blocked and it will be impossible to insert new lines. Also, using IsEmpy or setrange, setfilter functions with no selectivity key can cause a table lock - the SQL server lock whole table to prevent new records in selected criteria range.Looking for part-time work.
Nav, T-SQL.0 -
The problem is solved. There was a weird customization done some time ago that prevented nav to Group up the lines with the same e.g. G/l account, dimension, blablabla when posting to the G/L entries. This DESTROYED performances during sales invoice posting.0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions