Bulk document reposting
This feature is intended for bulk reposting of a large number of documents. It is faster than reposting individual documents.
Backdate posting of documents might include accessing outdated accumulation or accounting register totals (for example, accessing Balances virtual tables of these registers), which slows down the posting.
To understand what exactly causes the delay when accessing outdated totals, you need to know how 1C:Enterprise retrieves register balances. Let us review an example with an accumulation register.
Data belonging to an accumulation register of Balances type is stored in two database tables: the records table and the totals table. The first table has predefined structure, you can use the following query to retrieve its data:
SELECT * FROM AccumulationRegister.ProductStock
The second table is auxiliary. It stores calculated balances by register dimensions and periods (months). This table always stores up-to-date balances (as of the current date). Balances for other periods are added during the recalculation of register totals. The records being added match the register balances calculated for the beginning of the next month after the specified date.
In other words, if a register was calculated till 10/31/2013, the balances table contains records dated till 11/01/2013 0:00:00.
Accordingly, retrieving a balance by a set of dimensions for any date (not the current one) may have the following simplified explanation:
- Retrieve the first balance after the specified date from the totals table. If calculated totals are not available, the current balance is used instead (it is always available).
- Subtract register records retrieved from the register records table by the specified set of dimensions for the period between the date of the balance retrieved in step 1 and the specified date.
The ProductStock accumulation register is calculated up to 10/31/2013.
You need to retrieve the balance dated 10/05/2013 13:00:00.
The balance dated 11/01/2013 is retrieved from Balance table.
Then the register records by the specified dimensions for the period between 10/05/2013 13:00:00 and 11/01/2013 0:00:00 are subtracted from the balance.
Thus, the more documents are posted during the period between the specified date and the calculated totals boundary, the longer the time required for query processing, and the dependency is nonlinear.
The method described in this article takes the algorithm described above into account. To speed up the posting, the number of register records that belong to the period between the document date and the next balance calculation date should be reduced. This can be achieved if you delete all the register records that belong to that period.
In other words, bulk document reposting is performed in two steps:
- In the first step, register records of all documents in the reposting period are deleted.
- In the second step, the documents are reposted. The query to the register totals is performed faster because there are no records with later dates in the register table.
Bulk document reposting has the following limitation: it requires reposting all documents between the specified date and the next calculted totals boundary (or up to the latest document if the boundary is not set).
Also keep in mind that bulk reposting does not delete register records that are entered manually. Such records come from documents that do not use the Posting() procedure, users enter the records manually instead. An example of such a document is Transaction in 1C:Small Business, where users specify the register records in the document form.
If your infobase includes a large number of such documents, this might impact the performance of bulk reposting.