Browse Source

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
pull/269/head
eLBati 7 years ago
committed by Jairo Llopis
parent
commit
4173794526
  1. 2
      mail_tracking/__manifest__.py
  2. 3
      mail_tracking/models/mail_tracking_email.py
  3. 2
      mail_tracking/models/mail_tracking_event.py

2
mail_tracking/__manifest__.py

@ -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, "

3
mail_tracking/models/mail_tracking_email.py

@ -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(

2
mail_tracking/models/mail_tracking_event.py

@ -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'),

Loading…
Cancel
Save