Deleting change log entries

TESDeveloper
Member Posts: 42
We need to delete 50,000,000 change log entries via sql. How long would you expect this to take and is there anything i should consider before doing this?
The entries were created in error and aren't needed.
Thanks
The entries were created in error and aren't needed.
Thanks
0
Answers
-
I would rather pick hours than minutes, imho.
If you are about to clear all the table entirely use TRUNCATE, not DELETE. If you want to leave some of the records then do not delete remaining 50mil all in one go, all in one transaction, as this will likely lead to transaction log expansion, which is very costly and time-consuming operation. Delete them in batches 10k-100k records at a time instead, usingDELETE TOP (nnnnnn) FROM...; GO nnnn
(GO nnnn is the SSMS directive/command hence works from SSMS only)
Alternatively, select rows which are supposed to remain into a temp table, then truncate the change log entry table, and then copy back required data.
Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
I have some experience in this delete large number of entries. Used Truncate so it was not that bad.United Kingdom0
-
Truncate would be the best. If you can't use it, best first disable secondary keys and then delete the records (How:see other posts) and then re-enable the secondary keys again.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
I also did Truncate long back but it took way more time I remember as there were around 5 crore data. Try truncating post business hours and leave then!!Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/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