Slow delete from Reservation Entry Table

Alex_Chow
Member Posts: 5,063
We have a client that receives and ships using Lot numbers.
Over the years, the Reservation Entry has become quite large. Now it takes forever to run the Requisition Worksheet.
When using the client monitor in addition to the SQL Server Profiler, this statement seems to be taking a long time.
The process where this slows down is in codeunit 99000853 - Inventory Profile Offsetting. In the DeleteTracking function, there's a code to loop through the Reservation Entry table, then it does a delete.
I noticed that no index was used when you delete. Is there a way to improve the performance of the delete?
I'm using NAV2009 without the SP1.
Over the years, the Reservation Entry has become quite large. Now it takes forever to run the Requisition Worksheet.
When using the client monitor in addition to the SQL Server Profiler, this statement seems to be taking a long time.
DELETE FROM "ClientServer"."dbo"."CRONUS Company$Reservation Entry" WITH (REPEATABLEREAD) WHERE ("Entry No_"=@P1 AND "Positive"=@P2)
The process where this slows down is in codeunit 99000853 - Inventory Profile Offsetting. In the DeleteTracking function, there's a code to loop through the Reservation Entry table, then it does a delete.
I noticed that no index was used when you delete. Is there a way to improve the performance of the delete?
I'm using NAV2009 without the SP1.
Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
0
Answers
-
Over the years, the Reservation Entry has become quite large
Why? There should be only entries for active documents, nothing "historical"... Thus number of entries could be bigger if you have bigger count of opened documents/lots/ser.nos., but not "Over the years" like posted entries...
And second thing - have you some SIFT maintenance? (deleting zero SIFT records)0 -
Was this an upgraded database? Is it possible it has the bug where there is no clustered index on the primary key?David Singleton0
-
kine wrote:Why? There should be only entries for active documents, nothing "historical"... Thus number of entries could be bigger if you have bigger count of opened documents/lots/ser.nos., but not "Over the years" like posted entries...
You're right. There are unusally a large amount of reservation entries. Even so, I'm not sure why it takes so long to delete?kine wrote:And second thing - have you some SIFT maintenance? (deleting zero SIFT records)
I thought the delete 0 Sift records doesn't apply to VSIFT? I'll try it out.Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
David Singleton wrote:Was this an upgraded database? Is it possible it has the bug where there is no clustered index on the primary key?
No, the clustered index is properly set.Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
Ok, I figured out what the problem is.
When you use the Get Receipt Line to do invoicing. The original PO doesn't get deleted so the item tracking entries remain open in the Reservation Entry.
After a purge of completed PO, it's a lot faster now. \:D/Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
Alex Chow wrote:David Singleton wrote:Was this an upgraded database? Is it possible it has the bug where there is no clustered index on the primary key?
No, the clustered index is properly set.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
kriki wrote:Don't trust that property in NAV. Check directly in SQL. I have a customer (recently) in which the property is set, but if I check in SQL, it is not set. After all, I think I will write a blog about it.
How can that be? If this is the case, how do you enable it? Turn it off, save, then turn it back on?Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
Alex Chow wrote:kriki wrote:Don't trust that property in NAV. Check directly in SQL. I have a customer (recently) in which the property is set, but if I check in SQL, it is not set. After all, I think I will write a blog about it.
How can that be? If this is the case, how do you enable it? Turn it off, save, then turn it back on?
Well, I didn't wait to long to blog about it: here it is http://mibuso.com/blogs/kriki/2010/03/18/clustered-or-not-clustered/.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