2

Posting a journal batch takes about 5% of the total time. This is because deletes are extremely slow (known SQL Server issue).

My solution is to separate the posting of the journals from the deletion after posting of the journals.

To do this, I would update a new flag on the journal batch when the journals have posted.

Then execute a separate routine that deletes all the journals which will result in the Ledger tables not being locked. This will avoid the lockouts that occur when users post a very large journal batch.

Recently had the problem where a user posted 47,000 journal lines and locked the system for over 2 hours.

By separating the posting (using an event), then deleting the journals in a separate process, I reduced the lockout to only about 5 minutes.

🔧 To Reproduce

Steps to reproduce the behavior:

  1. Create a large G/L Journal batch (at least 10,000 lines).
  2. Click the post.
  3. The post will show 100% complete, then take much longer to finish (this is the Deleteall statement when it deletes the posted journal lines.)
  4. No error - just very, very slow.

Note: this could be made universal by applying it to all transaction posting. Sometimes sales and purchase orders have a huge number of lines.


Category: General
STATUS DETAILS
Needs Votes
Ideas Administrator

Thank you for this suggestion! Currently this is not on our roadmap. We are tracking this idea and if it gathers more votes and comments we will consider it in the future. Best regards, Business Central Team

Comments

D

Nice idea, but i think there are some things we should check before implementing it.Will the journal become available to the next job earlier? I think no, because the delete has to finish before you are able to enter new lines. So this should be only an option for a specific Journal- Batch that is only run once a day or in larger intervals.If this would not become an option to the batch, what would happen to batches that are used in short intervals like document posting. How can we assure that the journal is empty before the next journal is posted.What happens if the background process did not run or was not able to finish?

Category: General