Files
odoo_source/addons/mail
Olivier Dony 84af9382e2 [IMP] mail: avoid costly queries on messages
The combined domain for moderated messages used to trigger a complex
database query with two OR conditions on the mail_message table.
Unfortunately PostgreSQL seems to be unable to optimize this with
indexes, or to detect that one of the conditions is void (included `AND
FALSE`). On large mail_message tables, this significantly slows down
calls to message_fetch, e.g. 6s instead of ~70ms, while returning the
same results.

As a workaround, move the logic for generating the moderation domain to
the server side, where it can be:
 - optimized out when the user is not a moderator
 - split into 2 distinct DB queries in order to avoid the pathological
   case

After this change, calls to message_fetch with and without messages
to moderate execute in respectively ~50ms and ~150ms, instead of 6s, in
a test database with 25 million messages.

The modified message_fetch signature is backwards-compatible.

+ modified mock server used for the tests, which unfortunately
duplicates most of the business logic.
2018-09-20 12:41:03 +02:00
..
…

Odoo Enterprise Social Network

Connect with experts, follow what interests you, share documents and promote best practices with Odoo Enterprise Social Network. Get work done with effective collaboration across departments, geographies, documents and business applications. All of this while decreasing email overload.

Connect with experts

Next time you have a question for the marketing, sales, R&D or any other department, don't send an email blast-post the question to Odoo and get answers from the right persons.

Follow what interests you

Want to get informed about new product features, hot deals, bottlenecks in projects or any other event? Just follow what interests you to get the information you need what you need; no more, no less.

Get Things Done

You can process (not only read) the inbox and easily mark messages for future actions. Start feeling the pleasure of having an empty inbox every day; no more overload of information.

Promote best practices

Cut back on meetings and email chains by working together in groups of interests. Create a group to let people share files, discuss ideas, and vote to promote best practices.

Improve Access to Information and Expertise

Break down information silos. Search across your existing systems to find the answers and expertise you need to complete projects quickly.

Collaborate securely

Set the right security policy; public, private or on invitation only -- according to the information sensitivity.

A Twitter-like Network For My Company

Make every employee feel more connected and engaged with twitter-like features for your own company. Follow people, share best practices, 'like' top ideas, etc.