tabSeries may cause a bad performance when batch insert documents?

Recently I found a problem that when I insert documents like Sales Order continuously, it causes bad performance, even Deadlock.

I found the problem is caused by this SQL
select current from tabSeries where name=%s for update

This SQL’s time consumption increases with increasing documents which will be created. This SQL seems causing table lock equivalently.

This is to make sure that 2 documents don’t have the same id. Do you have a better solution?

Hi,

I have the same problem, when process a Landed Cost Voucher, Purchase Receipt or Stock Entry and at once operating sales team.This is a big problem because affect sales point.
I think that should be used bigint auto_increment for primary key in Stock Ledger Entry and even for General Ledger, since these come all transactions, plus these do not have child tables.

What say?

@rmehta …what about an ID column with auto increment?

1 Like

A temporary solution is adding index on name in tabSeries otherwise a table lock will be raised.

Our ERPNext has to connect to other systems, we have to write a brand new API to receive SO/DN/SINV from other systems, one way to reduce lock frequency on tabSeries is that batch generate voucher ids we need in advance(e.g. tabSales Taxes and Charges and tabStock Ledger Entry etc.), and handle EACH voucher carefully(handle transaction manually).