Skip to content

ERP performance: why month-end close takes hours

B2Bnetwork team · · 6 min

System performance

In brief

Month-end close in an ERP system usually takes hours for several reasons at once: the transactional database holds many years of data, closing operations run one after another in a single thread, heavy reports run on the same database as posting and block each other, and customizations added over the years process data row by row. What helps is measuring each closing operation separately, analyzing database waits and only then fixing: archiving, reports from a replica, indexes and statistics, job order.

What actually happens at month-end close

Month-end close is not a single operation but a series of jobs, many of which read and recalculate the whole month or the entire history. In a typical trading or manufacturing company they are:

OperationWhat it does with the dataWhy it can be slow
Inventory issue valuationrecalculates the cost of every issue under the valuation methodbackdated correction documents force recalculation of many months
Production cost settlementallocates costs to orders and productsmany links: orders, materials, labor time
Depreciationcalculates charges for every fixed assetusually fast, unless a customization calculates it item by item
Foreign currency revaluationrevalues open items at the exchange ratea large number of open items
Accruals and deferralscreates journal entries from schedulesusually fast
Statements and reportstrial balance, cost analyses, management reportsthey read whole tables, often while posting is under way
Tax files and exportscollect documents for the period, for example JPK, Poland's standard audit file for taxlarge queries on document tables

Each of these operations alone might take a few minutes. The problem appears when several take an hour, run one after another, and people launch reports at the same time.

Five common causes

  1. Volume. After a few years an ERP database holds millions of document lines. Queries that read thousands of rows at go-live now read millions, because nobody limited them to the period or an index on the date is missing.
  2. Reports on the transactional database. A heavy report that reads a whole year, running at the same time as inventory valuation, competes for disk and memory, and sometimes for locks. Both operations slow down.
  3. Locks. A closing operation locks tables or row ranges while it recalculates. Other users and integrations wait, and their transactions in turn block others. In the database this shows up as long blocking chains.
  4. Customizations that process row by row. A procedure added a few years ago opens a cursor over all documents of the month and runs several queries for each. With a hundred documents that takes seconds; with a hundred thousand it takes hours.
  5. Stale statistics and fragmentation. The database optimizer picks a query plan based on statistics. After a large import, or at month-end when tables grow quickly, statistics can be out of date and the database chooses a bad plan.

Infrastructure adds to this: a database virtual machine with shared storage that also handles backups at night can stretch every one of these operations.

How to measure it before changing anything

Instead of guessing, collect data at the next close:

  1. A close timeline. Start and end of each operation, who launched it, what ran in parallel. It often turns out that three operations take most of the time.
  2. Database waits. Database engines show what sessions are waiting for: disk, locks, memory, network. In SQL Server the wait statistics view does this, in PostgreSQL the activity and lock views.
  3. The heaviest queries during the close, with execution plans. How to read plans is covered in SQL query performance and execution plans.
  4. Blocking chains: which session blocks which and for how long.
  5. Server resources: CPU, memory and disk queue over the same period.

This data lets you answer whether the problem is one customization, reports launched at the wrong moment or simply storage that is too slow. Typical database bottlenecks are covered in Database bottlenecks.

What usually shortens the close

ProblemFixWatch out for
Many years of volume in one databasearchiving closed years using the ERP vendor's proceduredocument retention requirements and access for auditors
Reports during postingreports from a database replica or a data warehousedata delay in the replica
Locks between operationsjob order, separate windows for reports and integrationsintegrations that run around the clock
Row-by-row customizationsrewriting them as set-based SQL operationstesting results on a copy of production
Stale statisticsupdating statistics after large imports and before the closethe update itself takes time on large tables
Missing indexesindexes on columns used in closing filterswrite cost for every new index

Management reports that load the ERP today are often better moved to a separate analytical database, as covered in A data warehouse for a mid-sized company.

A performance test of the close before a change

Every ERP change that touches the close deserves a test: a version upgrade, a new customization, moving the database to another server or to the cloud, adding a new subsidiary with its volume. The test runs on a copy of the production database with data from the last close. You run the same operations in the same order while reproducing typical user and integration traffic in parallel. The result is compared with the production timeline.

The close also has a process side: missing invoices, mismatched balances, manual reconciliations. That part is covered in A faster month-end close. At B2Bnetwork, performance testing also covers batch operations and reports, not just user screens.

Questions and answers

Will a more powerful server fix a long close?

Sometimes, if the bottleneck is disk or memory. When the cause is locks, row-by-row customizations or a bad query plan, a stronger server shortens the time only slightly, while per-core database license costs may grow. Measure first, then decide on hardware.

Can ERP data be archived without losing history?

Yes, if you use the procedure provided by the system vendor and meet document retention obligations. Data from closed years goes to an archive or a separate database from which it can be read during an audit. Agree the scope with accounting and the auditor before archiving.

Why was the close fast after go-live and takes hours now?

Most often because of data growth and customizations added in later years. Queries and procedures that ran fast at low volume were never tested at today's volume. A close timeline usually shows quickly which operations have grown the most.

Can reports run during the close?

Light ones yes, heavy ones better not. Reports that read a whole year compete with closing operations for disk and locks. The simplest fix is to move them to a database replica or a data warehouse, or to set a window in which they do not run alongside inventory valuation and cost settlement.

Your system slows down under load? We'll find where it loses time.

Let's talk

Read more: System performance

All in System performance →