diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2017-09-04 14:52:03 +0200 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2017-09-06 17:14:45 +0200 |
| commit | 60dbf05750532519c4cb73cd764ca9df37d7b229 (patch) | |
| tree | 9ea91fb24d26614eeaa2b1f97de338de0fac39dd /addons/web_editor/static/src/js | |
| parent | ce9bbf6c10962e64138c04ca34b7485084e4cdaa (diff) | |
[FIX] stock: performance issue
Commit 6a366b216b3d1 introduces a subquery when fetching translations in
order to avoid fetching duplicates. On large a `ir.translation` table
(~500000 records), this can cause a major performance degradation when
the user is not using the English language.
A typical example is a `read_group` call such as:
```
self.env['stock.quant'].with_context(lang='fr_BE').read_group([
('location_id', 'child_of', self.env.ref('stock.stock_location_stock').id)],
['product_id', 'qty'], ['product_id'], limit=80)
```
When no `orderby` parameter is used, the `groupby` fields are
implicitly used for ordering. While this makes sense for direct calls
from the web client, this implicit order might be problematic for
programmatic calls (such as computed fields). Indeed, in case of
grouping by product, the subquery mentioned earlier is used to sort by
product name. This is costly, and in most of the cases useless.
The workaround is to explicitely order by `id`, to avoid the use of the
subquery. For the upcoming version, a cleaner fix should be made in
order to prevent duplicated translations, and get rid of the subquery.
opw-767532
Diffstat (limited to 'addons/web_editor/static/src/js')
0 files changed, 0 insertions, 0 deletions
