mail: 'Send a message' generates excessively slow queries
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
New
|
Undecided
|
OpenERP Publisher's Warranty Team | |||
OpenERP Community Backports (Addons) | Status tracked in 7.0 | |||||
7.0 |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
Using the "Send a message" action on a model having a mail.thread, I notice a very long delay (8-10 seconds) before the action is done.
I used the debug_sql log level and could see that this slowness is due to the queries generated by the ORM.
In the `mail_message` module, in `mail_message.
fol_ids = fol_obj.search(cr, SUPERUSER_ID, [
], context=context)
Which results in:
2014-04-22 14:00:05 CEST LOG: duration: 1138.682 ms statement: SELECT "mail_followers_id" FROM "mail_followers
2014-04-22 14:00:21 CEST LOG: duration: 2544.561 ms statement: SELECT "mail_followers".id FROM "mail_followers" WHERE ((("mail_
where (1,2,3,4,5, .....) contains the IDs returned by the first statement (2.500.000 ids here).
Same result could be done with a query using JOINs:
SELECT mail_followers.id
FROM mail_followers
INNER JOIN mail_followers_
ON rel.mail_
WHERE mail_followers.
AND mail_followers.
AND rel.mail_
ORDER BY mail_followers.id
Then, it takes merely a millisecond instead of several seconds.
Related branches
- Holger Brunn (Therp): Disapprove
- Leonardo Pistone: Approve
-
Diff: 17 lines (+4/-2)1 file modifiedmail/mail_message.py (+4/-2)
Changed in openobject-addons: | |
assignee: | nobody → OpenERP Publisher's Warranty Team (openerp-opw) |
tags: | added: maintenance |