odoo/openerp
Raphael Collet 3c2065c89d [FIX] expression: use sub-select when searching on many2many field
Avoid pathological performance issue caused by injecting ids retrieved with
another query.

Consider a domain like `[('m2m', 'in', ids)]` on a many2many field.  The
current implementation will perform the subquery:

    SELECT m2m_id1 FROM m2m_table WHERE m2m_id2 IN (ids)

and inject its result into the main query as:

    SELECT id FROM ... WHERE id IN (result_ids)

The latter may be very slow if `result_ids` is a huge list of ids.

The fix injects the first query into the main query as:

    SELECT id FROM ... WHERE id IN (
        SELECT m2m_id1 FROM m2m_table WHERE m2m_id2 IN (ids)
    )

As a result, the database will typically JOIN both tables, and avoid generating
the whole list from the subquery.
2017-04-06 15:59:50 +02:00
..
addons [I18N] Update translation terms from Transifex 2017-04-02 02:56:31 +02:00
cli [FIX] scaffold: correctly decode utf8 templates 2016-03-15 11:25:16 +01:00
conf [MERGE] openerp.pooler is deprecated. 2013-03-27 17:40:45 +01:00
modules [FIX] module: allow disabling 1-click install 2017-01-27 13:00:42 +01:00
osv [FIX] expression: use sub-select when searching on many2many field 2017-04-06 15:59:50 +02:00
report [MERGE] forward port of branch 7.0 up to 99c87b6 2015-05-21 16:33:45 +02:00
service [FIX] server: avoid cron thread death 2017-02-28 18:00:50 +01:00
tests [IMP] tests: use long message in case of error 2016-11-02 11:45:29 +01:00
tools [FIX] config: correctly bootstrap data_dir 2017-01-28 00:53:20 +01:00
workflow [MERGE] forward port of branch saas-3 up to 2e9b33b 2015-11-03 12:45:50 +01:00
PKG-INFO [REM] netrpc: KILL EVERYBODY 2013-02-21 13:18:25 +01:00
__init__.py [IMP] fields: turn field.digits and column.digits into dynamic properties 2015-03-23 14:36:15 +01:00
api.py [FIX] api: in todo list, group records to recompute by environment (#11267) 2016-10-13 10:13:33 +02:00
exceptions.py [ADD] doc: new documentation, with training tutorials, and new scaffolding 2014-08-22 17:51:20 +02:00
fields.py [FIX] fields: add group_operator to be availble in get_description. 2016-10-11 11:49:55 +02:00
http.py [FIX] http: setup_lang in Safari 2017-03-22 17:03:23 +01:00
import_xml.rng [MERGE] ir-ui-view split active and show_customize 2014-08-31 16:56:44 +02:00
loglevels.py [REF] logging: removed pseudo log-level TEST. 2013-03-26 16:58:44 +01:00
models.py [FIX] openerp: fix traceback when no field in constrains 2017-03-31 11:52:31 +02:00
netsvc.py [MERGE] forward port of branch 7.0 up to 1c0bc7c 2015-06-30 12:47:27 +02:00
pooler.py [IMP] registry: avoid every direct access registry.db, and rename attribute as registry._db 2014-04-09 15:35:15 +02:00
release.py [REL] Odoo 8.0 2014-09-18 12:11:18 +02:00
sql_db.py [IMP] fields: use a "lazy" cursor to compute attribute `digits` 2016-01-29 09:37:27 +01:00