Friday, January 17, 2025
1 change
Resolved issues and error corrections
The sales commission report now loads much faster by making database lookup rules match the invoices included in the report. This removes a slowdown that affected large databases, reducing report load times from minutes to seconds in benchmarked cases.
Original PR description
## Description Following 9a8777b4b96367597418cdc1c1ffc7ea3264113f, the criteria on the `move_type` of the invoices used in `sale.commission.report` was changed from `'out_invoice'` to `'out_invoice' AND 'out_refund'`, but the respective index `account_move_invoice_user_id_date_idx` partial clause hasn't been updated, leading to Postgres not being able to use the index, leading to a performance regression. We're updating both custom indexes partial clause to match the invoice `move_type` condition used in the reporting. ## Benchmark On a large database with millions of invoices and customers | Timings (hot) | Before | After | |---------------|--------|-------| | 1 read_group | 40s | 1s | | full load | 225s | 6s | ## Reference task-4448879