IMP mail_tracking performances

On our server,
queries based on "mail_tracking_event"."tracking_email_id" improved from 501,924 ms to 1,840 ms
queries based on "mail_tracking_email"."mail_message_id" improved from 167,436 ms to 3,223 ms

The last ones are run several times when a thread has many messages
This commit is contained in:
eLBati 2018-02-21 18:00:36 +01:00 committed by Jasmin Solanki
parent 2c5a5647db
commit 86031a98a9
3 changed files with 4 additions and 3 deletions

View File

@ -5,7 +5,7 @@
{ {
"name": "Email tracking", "name": "Email tracking",
"summary": "Email tracking system for all mails sent", "summary": "Email tracking system for all mails sent",
"version": "10.0.1.0.1", "version": "10.0.1.1.0",
"category": "Social Network", "category": "Social Network",
"website": "http://www.tecnativa.com", "website": "http://www.tecnativa.com",
"author": "Tecnativa, " "author": "Tecnativa, "

View File

@ -39,7 +39,8 @@ class MailTrackingEmail(models.Model):
date = fields.Date( date = fields.Date(
string="Date", readonly=True, compute="_compute_date", store=True) string="Date", readonly=True, compute="_compute_date", store=True)
mail_message_id = fields.Many2one( mail_message_id = fields.Many2one(
string="Message", comodel_name='mail.message', readonly=True) string="Message", comodel_name='mail.message', readonly=True,
index=True)
mail_id = fields.Many2one( mail_id = fields.Many2one(
string="Email", comodel_name='mail.mail', readonly=True) string="Email", comodel_name='mail.mail', readonly=True)
partner_id = fields.Many2one( partner_id = fields.Many2one(

View File

@ -28,7 +28,7 @@ class MailTrackingEvent(models.Model):
string="Date", readonly=True, compute="_compute_date", store=True) string="Date", readonly=True, compute="_compute_date", store=True)
tracking_email_id = fields.Many2one( tracking_email_id = fields.Many2one(
string='Message', readonly=True, required=True, ondelete='cascade', string='Message', readonly=True, required=True, ondelete='cascade',
comodel_name='mail.tracking.email') comodel_name='mail.tracking.email', index=True)
event_type = fields.Selection(string='Event type', selection=[ event_type = fields.Selection(string='Event type', selection=[
('sent', 'Sent'), ('sent', 'Sent'),
('delivered', 'Delivered'), ('delivered', 'Delivered'),