summaryrefslogtreecommitdiff
path: root/doc/reference/javascript_api.rst
diff options
context:
space:
mode:
authorGuewen Baconnier <guewen.baconnier@camptocamp.com>2020-06-03 12:41:30 +0000
committerRaphael Collet (rco) <rco@openerp.com>2020-06-25 08:40:21 +0000
commita3530774527343db2de9445ad7d380888f731adc (patch)
tree6027f33740e6e61b2beb68de066ac3c5f509d588 /doc/reference/javascript_api.rst
parent33e38be68800727caa7f86446611455641d2d8e7 (diff)
[FIX] expression: simplify sub-searches order
Performance fix: when parsing domains using special operators (`child_of`, ...), or with dotted field on the left value (`['partner_id.name', ...]`), the ORM starts by a first call on `search()` and builds a new domain so the final query has "IN (<ids found by sub-search>)". The sub-search issued on the comodel uses the default "order by". The order of the ids is irrelevant here, we only need to know the ids. A good example is when the sub-search happens on `product.product`, which is ordered by `default_code, name, id`. The field `name` is inherited and translated, so the ordering requires a JOIN on `product_template` and a LEFT JOIN on `ir_translation`. Ordering by `id` avoids these 2 JOINs. Some discussion took place about modifying `_generate_order_by()` to remove the `ORDER BY` clause when the `order` argument is False or ''. Apart the fact that it would be a breaking change, @odony has shown that sorting by `id` is so cheap that removing the `ORDER BY` might not bring significant performance boost [0]. [0] https://github.com/odoo/odoo/pull/52368#issuecomment-646643773 opw-2270690 closes odoo/odoo#53629 X-original-commit: fc91f7b4e8f9f8a95862df1ce95a9639cf7d1363 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com> Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Diffstat (limited to 'doc/reference/javascript_api.rst')
0 files changed, 0 insertions, 0 deletions