diff options
| author | xmo-odoo <xmo@odoo.com> | 2017-08-10 14:51:27 +0200 |
|---|---|---|
| committer | Raphael Collet <rco@odoo.com> | 2017-08-10 14:51:27 +0200 |
| commit | d140f0ef0e7d9cb3eb4a6ad344ae761936a0a288 (patch) | |
| tree | f0e323657b56fff5ea288c7278a75b48d6a29b48 /addons/website_event/controllers/main.py | |
| parent | 354539942d29acc4cfefdb8851ed18ff1bdd4b63 (diff) | |
[FIX] prefetch issues on computed/related fields (#18644)
When deciding to prefetch records (getting records from the cache with
no value for the field being fetched), if the field was computed
`determine_value` would just get all records, not limited by the normal
prefetch limit; for large recordsets this would generate gigantic
prefetch lists for records we may not need at all.
Fix by applying the `PREFETCH_MAX` limit to records from the cache as is
done in `_prefetch_field`.
Complementarily, when traversing related fields the prefetch
environment would be lost and every record would get an empty prefetch
environment, so the values would ultimately be read one by one.
Example: select (search) 1000 product.product records, access a
related field (e.g. categ_id) in a loop, on the first iteration the
system would first read 1000 templates, then it would read each
categ_id individually, resulting in >1000 SQL queries rather than the
~2 we would expect.
Fixes #18511
Diffstat (limited to 'addons/website_event/controllers/main.py')
0 files changed, 0 insertions, 0 deletions
