Rémy Voet (ryv)
5a573c6f18
[IMP] base: don't prefetch translate field by default
...
Issue
-----
Via the field prefetch mechanism, when we need a value of one field
(not in cache of course), the ORM will prefetch all fields
(which has the attribute to `prefetch=True`, the default value of this
attribute is `True`) for all record ids in `_prefetch_ids`.
Then, for each translate fields (where translate is not a callable)
the ORM need to make a `LEFT JOIN` on the `ir_translation` to fetch the
translated value. For big model, it leads to a simple `SELECT` with
several `LEFT JOIN` on ir_translation but each LEFT JOIN have a cost
in the planner time (a small cost in the execution time) of PostgreSQL.
By example, for `product.template` (stock/sale/purchase installed),
there are 6 LEFT JOIN to get all translated fields (5 of this
fields are rarely used).
Proposed solution
-----------------
Deactivate the prefetch by default for all translate fields expect if
this field is the `_rec_name` of the model (which is more likely to
be used).
In the example on the `product.template`:
Without prefetching the translated fields, there is only one LEFT JOIN
(the name, which is translated but is the `_rec_name` of the model).
With the 6 translated fields to fetch, the
query takes 5 ms to plan and 2 ms to execute VS with 1 translate field,
it 1 ms to plan and 1.5 ms to execute.
Side change note
----------------
- All translate of fields of `website.seo.metadata` should be prefetch
to avoid lot of website errors (it is because, website put in cache data
in sudo before reading it without sudo)
- `description` (`mail.message.subtype`), `subject` (`mail.template`),
`body_html` (`mail.template`) should be prefetch to avoid lot of extra
query from mail module.
- `vat_label` (`res.country`) should be prefetch to avoid a extra query
for each website page.
- Increase some queryCount (when it is legit, due to `subtitle` of
`blog_post` or `description` of `event.type.ticket`, etc)
task-2738029
closes odoo/odoo#82896
Signed-off-by: Raphael Collet <rco@odoo.com >
2022-01-28 14:09:56 +00:00
..
2022-01-27 21:50:25 +00:00
2021-12-14 19:13:18 +00:00
2021-11-10 06:49:58 +00:00
2022-01-05 11:36:06 +00:00
2021-12-24 13:11:50 +00:00
2021-11-22 14:48:04 +00:00
2022-01-10 19:28:36 +00:00
2021-12-08 16:28:53 +00:00
2022-01-25 09:56:59 +00:00
2021-11-08 09:25:47 +00:00
2021-11-23 11:12:14 +00:00
2022-01-19 16:52:23 +00:00
2021-12-08 11:17:22 +00:00
2021-11-26 09:44:58 +00:00
2021-11-10 09:58:09 +00:00
2022-01-27 07:03:03 +00:00
2021-11-22 14:48:04 +00:00
2021-11-22 14:48:04 +00:00
2022-01-25 17:21:04 +00:00
2022-01-20 11:03:01 +00:00
2021-12-07 13:48:53 +00:00
2022-01-22 14:13:41 +00:00
2021-12-14 12:39:54 +00:00
2021-10-28 09:17:34 +00:00
2021-12-07 13:48:53 +00:00
2021-12-13 12:24:50 +00:00
2022-01-20 11:03:01 +00:00
2022-01-26 08:48:52 +00:00
2021-12-16 09:00:19 +00:00
2021-12-14 19:13:18 +00:00
2022-01-19 16:52:23 +00:00
2022-01-21 15:03:57 +00:00
2022-01-19 16:52:23 +00:00
2021-12-15 00:10:51 +00:00
2021-12-14 12:39:54 +00:00
2022-01-26 13:11:21 +00:00
2021-12-02 12:12:01 +01:00
2021-12-08 09:35:03 +00:00
2022-01-28 14:09:56 +00:00
2021-12-16 17:33:47 +00:00
2022-01-12 16:43:37 +00:00
2021-12-24 14:57:02 +00:00
2022-01-19 16:52:23 +00:00
2021-12-16 17:33:47 +00:00
2022-01-27 09:12:50 +00:00
2022-01-27 09:12:50 +00:00
2022-01-13 09:30:56 +00:00
2022-01-19 16:52:23 +00:00
2021-10-11 10:15:49 +00:00
2022-01-27 09:12:50 +00:00
2022-01-20 08:21:58 +00:00
2022-01-27 09:12:50 +00:00
2021-11-22 14:48:04 +00:00
2022-01-12 08:33:00 +00:00
2022-01-26 15:59:03 +00:00
2022-01-24 12:02:48 +00:00
2022-01-27 16:17:17 +00:00
2022-01-11 16:18:49 +00:00
2022-01-20 16:08:22 +00:00
2022-01-26 15:59:03 +00:00
2021-12-07 13:48:53 +00:00
2021-12-14 19:13:18 +00:00
2021-12-09 16:14:43 +00:00
2021-12-07 13:48:53 +00:00
2022-01-24 11:09:50 +00:00
2021-12-25 02:26:44 +00:00
2021-12-20 07:55:41 +00:00
2021-12-15 12:07:26 +00:00
2022-01-19 16:52:23 +00:00
2022-01-03 18:11:19 +00:00
2022-01-26 15:59:03 +00:00
2022-01-28 14:09:56 +00:00
2022-01-04 10:26:16 +00:00
2021-12-14 12:39:54 +00:00
2021-10-07 17:59:52 +00:00
2021-10-07 17:59:52 +00:00
2021-10-19 15:58:58 +00:00
2022-01-21 15:03:57 +00:00
2022-01-22 11:51:42 +00:00
2021-11-25 00:31:17 +00:00
2021-12-08 11:17:22 +00:00
2022-01-20 17:39:16 +00:00
2021-11-25 00:31:17 +00:00
2022-01-27 16:17:10 +00:00
2022-01-13 14:35:57 +00:00
2022-01-18 08:18:06 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2021-10-01 12:40:54 +00:00
2022-01-27 10:09:43 +00:00
2022-01-25 17:21:04 +00:00
2022-01-25 17:21:04 +00:00
2022-01-25 17:21:04 +00:00
2022-01-27 21:50:25 +00:00
2021-10-01 12:40:54 +00:00
2021-12-15 22:31:20 +00:00
2021-11-25 00:31:17 +00:00
2021-10-01 12:40:54 +00:00
2021-10-01 12:40:54 +00:00
2021-12-18 21:00:49 +00:00
2021-10-28 08:33:17 +00:00
2021-10-28 08:33:17 +00:00
2021-10-28 08:33:17 +00:00
2021-10-28 08:33:17 +00:00
2022-01-26 11:46:15 +00:00
2021-11-25 00:31:17 +00:00
2022-01-18 16:17:43 +00:00
2021-11-05 13:00:41 +00:00
2021-12-28 09:47:33 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2021-12-03 08:11:50 +00:00
2022-01-20 09:11:01 +00:00
2022-01-27 21:50:25 +00:00
2021-12-17 21:59:10 +00:00
2022-01-11 13:34:56 +00:00
2021-11-25 00:31:17 +00:00
2021-10-01 12:40:54 +00:00
2021-10-01 12:40:54 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2022-01-18 11:02:02 +00:00
2022-01-27 21:50:25 +00:00
2021-12-14 14:47:25 +00:00
2021-11-25 00:31:17 +00:00
2022-01-25 13:52:29 +00:00
2022-01-20 22:05:06 +00:00
2022-01-14 14:49:57 +00:00
2021-11-25 00:31:17 +00:00
2022-01-19 16:52:23 +00:00
2022-01-19 16:52:23 +00:00
2022-01-25 19:06:59 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2021-10-01 12:40:54 +00:00
2022-01-12 10:17:47 +00:00
2022-01-25 19:07:03 +00:00
2022-01-25 17:21:04 +00:00
2021-12-14 10:00:41 +00:00
2021-11-25 00:31:17 +00:00
2021-11-22 14:48:04 +00:00
2021-11-25 00:31:17 +00:00
2021-10-01 12:40:54 +00:00
2022-01-25 17:21:04 +00:00
2021-12-22 00:12:52 +00:00
2021-11-25 00:31:17 +00:00
2022-01-25 15:41:17 +00:00
2021-12-15 22:31:20 +00:00
2021-11-25 00:31:17 +00:00
2022-01-05 23:05:43 +00:00
2022-01-27 21:50:25 +00:00
2022-01-21 11:25:59 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2021-12-15 22:31:20 +00:00
2021-10-01 12:40:54 +00:00
2021-11-25 00:31:17 +00:00
2022-01-25 18:14:59 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2021-10-01 12:40:54 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2021-12-14 09:11:15 +00:00
2022-01-11 16:18:54 +00:00
2022-01-28 14:09:56 +00:00
2021-12-15 00:10:51 +00:00
2021-12-21 09:49:38 +00:00
2022-01-20 17:39:20 +00:00
2021-12-14 19:13:18 +00:00
2022-01-12 18:24:48 +00:00
2022-01-24 16:55:20 +00:00
2021-12-07 13:48:53 +00:00
2021-10-14 09:28:09 +00:00
2022-01-06 11:45:23 +00:00
2021-10-22 11:09:16 +00:00
2022-01-19 16:52:23 +00:00
2021-10-11 10:15:49 +00:00
2022-01-17 08:38:45 +00:00
2022-01-26 13:11:00 +00:00
2022-01-19 16:03:53 +00:00
2021-12-07 16:20:05 +00:00
2022-01-11 15:24:11 +00:00
2021-12-22 17:55:49 +00:00
2021-12-07 16:20:05 +00:00
2021-12-07 16:20:06 +00:00
2021-12-07 16:20:06 +00:00
2021-10-06 12:39:43 +00:00
2021-10-19 14:43:42 +00:00
2022-01-27 17:11:51 +00:00
2022-01-27 17:11:52 +00:00
2022-01-27 17:11:52 +00:00
2022-01-22 13:25:44 +00:00
2022-01-27 17:11:52 +00:00
2022-01-27 17:11:52 +00:00
2022-01-27 17:11:52 +00:00
2022-01-27 17:11:52 +00:00
2022-01-27 17:11:52 +00:00
2022-01-27 17:11:52 +00:00
2022-01-27 17:11:52 +00:00
2022-01-27 17:11:52 +00:00
2021-11-29 15:40:54 +00:00
2022-01-27 21:50:25 +00:00
2022-01-14 16:37:45 +00:00
2021-11-22 14:48:04 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-28 12:21:51 +00:00
2022-01-21 07:57:49 +00:00
2022-01-19 16:52:23 +00:00
2022-01-28 07:46:46 +00:00
2022-01-04 17:03:10 +00:00
2021-12-14 12:39:54 +00:00
2022-01-04 17:03:10 +00:00
2022-01-04 17:03:10 +00:00
2021-12-14 19:13:18 +00:00
2022-01-22 11:51:42 +00:00
2022-01-10 14:49:52 +00:00
2021-11-24 16:33:01 +00:00
2021-12-14 19:13:18 +00:00
2021-10-27 15:48:51 +00:00
2022-01-19 16:52:23 +00:00
2022-01-05 13:58:01 +01:00
2022-01-19 16:52:23 +00:00
2022-01-27 13:04:04 +00:00
2022-01-24 11:10:04 +00:00
2021-12-23 15:30:23 +01:00
2021-12-14 14:47:25 +00:00
2021-12-02 12:12:01 +01:00
2021-12-02 12:12:03 +01:00
2022-01-17 12:17:24 +00:00
2021-12-02 12:12:03 +01:00
2022-01-20 12:30:05 +00:00
2021-12-23 15:30:23 +01:00
2021-12-02 12:12:03 +01:00
2022-01-19 16:52:23 +00:00
2021-11-23 11:12:14 +00:00
2022-01-19 16:52:23 +00:00
2021-10-15 14:58:53 +00:00
2022-01-14 17:29:35 +00:00
2022-01-28 14:09:56 +00:00
2021-11-08 07:59:42 +00:00
2022-01-24 19:20:47 +00:00
2021-11-29 14:55:35 +00:00
2021-12-21 20:20:50 +00:00
2022-01-19 16:52:23 +00:00
2022-01-27 18:03:36 +00:00
2021-10-29 16:05:23 +00:00
2022-01-26 13:11:00 +00:00
2022-01-19 16:52:23 +00:00
2021-12-07 16:20:06 +00:00
2021-12-14 19:13:18 +00:00
2022-01-13 09:30:52 +00:00
2021-10-05 16:54:21 +00:00
2022-01-26 13:11:06 +00:00
2022-01-19 16:52:23 +00:00
2021-12-24 14:57:02 +00:00
2022-01-27 18:03:43 +00:00
2022-01-28 14:09:56 +00:00
2022-01-06 19:30:53 +00:00
2021-11-16 16:58:36 +00:00
2022-01-20 15:11:50 +00:00
2022-01-17 16:56:01 +00:00
2021-09-30 17:12:12 +00:00
2021-11-30 15:21:47 +00:00
2022-01-17 06:42:47 +00:00
2021-09-30 17:12:12 +00:00
2021-12-07 13:48:53 +00:00
2022-01-20 10:06:47 +00:00
2022-01-27 18:51:49 +00:00
2022-01-28 12:21:47 +00:00
2021-11-24 18:38:02 +00:00
2022-01-22 11:51:42 +00:00
2022-01-28 14:09:56 +00:00
2022-01-28 14:09:56 +00:00
2021-12-07 13:48:53 +00:00
2022-01-19 16:52:23 +00:00
2022-01-19 16:52:23 +00:00
2021-10-15 14:58:53 +00:00
2022-01-19 16:52:23 +00:00
2021-12-07 13:48:53 +00:00
2021-10-04 15:30:26 +00:00
2021-12-07 13:48:53 +00:00
2022-01-10 13:52:27 +00:00
2022-01-10 13:52:27 +00:00
2021-12-16 17:33:48 +00:00
2022-01-04 08:47:00 +00:00
2022-01-22 11:51:42 +00:00
2021-12-07 13:48:53 +00:00
2022-01-19 16:52:23 +00:00
2021-10-04 07:57:00 +00:00
2021-10-04 14:12:26 +00:00
2022-01-20 13:29:04 +00:00
2021-12-20 19:16:55 +00:00
2021-10-15 14:58:53 +00:00
2021-12-17 12:51:49 +00:00
2022-01-22 11:51:42 +00:00
2022-01-28 12:21:47 +00:00
2021-12-07 13:48:53 +00:00
2021-11-25 13:28:51 +00:00
2021-12-17 12:51:49 +00:00
2021-12-02 12:12:01 +01:00
2022-01-28 11:27:42 +00:00
2021-12-07 13:48:53 +00:00
2021-12-23 15:30:23 +01:00
2021-12-23 15:30:23 +01:00
2021-12-07 13:48:53 +00:00
2022-01-22 11:51:42 +00:00
2021-12-07 13:48:53 +00:00
2021-12-14 19:13:18 +00:00
2021-12-14 19:13:18 +00:00