Odoo Help


Unacceptable loading time due to mail.message object

Sofie Van Looveren
on 9/28/14, 3:25 AM 1,786 views

The loading times of Odoo is unacceptably slow. The environment contains a large number of products (around 500.000 items) and 4100 attachments are stored in the database. The application server is a virtual machine with 2 gb of memory and the OpenERP version is 7.0. When using this application it sometimes take 10 minutes to finish the confirmation of a sale order!

To have an idea of what database queries are taking so long, I used the performance tool pg badger to give an analysis of the running database queries for three days. I focused on the normalized slowest queries. Surprising was the duration of the ir_attachment and the mail_message queries. Where I expected the duration of the product_product and product_template would be very long, they took much less than on these tables.

Here are the average durations:
ir_attachment : 18m45s
mail_message : 16m15s
product_product : 2m40s
product_template: 1m15s

The result of ir_attachment can be explained by the retrieving of large documents from the database and can be fixed by using a file system instead. And the mail_message records, this object is used everywhere among the application, for almost every action a message is stored to have activity logging like on september 28 user admin created this invoice. This is useful and nice to have some logging to the end user but I don't want this to take too much database effort at the expense of other queries. I also saw that is you create a quotation, a mail_message record is also created but when you remove this quotation, the mail_message is not deleted and is hold in the database a death data that will not have any value left.

I there a way to solve the mail_message issue taking too much effort in the database?
Or can I disable this functionality in an easy way?

For now I deleted the whole table mail_message, which consisted over 7.000.000 messages. I also implemented following code to prevent the creation of new messages:

class mail_message(osv.Model):
    _inherit = 'mail.message'

    def create(self, cr, uid, values, context=None):
        return 0

On 8/5/17, 11:15 PM
Hello, I have the same problem, but I am working on odoo 10. How should I do so that you do not believe me or save all these messages in the BD? Please your help. Thank you

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

3 follower(s)


Asked: 9/28/14, 3:25 AM
Seen: 1786 times
Last updated: 8/5/17, 11:15 PM