On deletion of records, foreign keys are updated.
For larger tables (like account.move, account.bank.statement.line) this could take some time.
adding a "not null btree index" on sparsely populated many2one fields significantly improves performance.
In the analysis of deleting a bank statement line.
Before:
7.4s to delete the bank statement line (missing index on suspense_statement_line_id consuming 99% of the execution time)
3.8s to delete the corresponding account move
After:
With the indexes, a 700x performance improvement was found.
This opportunity is taken to add an index on all many2one fields to account.move & bank.statement.line.
Issue report by @tsb-odoo
closesodoo/odoo#145643
X-original-commit: f10b87991cc72f5e16b587b6c9ede7e338ec79ac
Related: odoo/enterprise#52466
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Habib Ayob (ayh) <ayh@odoo.com>