odoo/odoo#143543

Created by Benjamin Hanquin (beha)
label
odoo-dev:15.0-product-fix_speedup_name_search_no_variants-beha
head
4766bad1aebbbeec31ccfdbe367490701c3a9235
target
15.0
merged
6 months ago by Benjamin Hanquin (beha)
forward-ports

[PERF] product: Improve name_search performance

# Issue:
The name_search performance was highly inefficient with a high number of records.

# Analyze:
The bottleneck came from the NOT IN search on the product_template.

# Fix:
As a NOT IN is not efficient, an not exists must be used.

# Note:
The ORM has to be bypassed has no "not exists" feature has been implemented yet.

# Benchmark:
| # Input data | Before PR | After PR |
|:-------------:|:----------:|:---------:|
| 182386 | 15+ min | ~100 ms |
| 29 | ~29 ms | ~28 ms |

# Related task:
opw-3554133