[PERF] project: add an index on create_date

Description:
In eedf37d6e2 the index on
`create_date` was removed, but it was still left on our production
database. After recent analysis on the usage of the index over the
span of 2 months (start July 2023 -> end of August 2023), this index
was hit over *100M* times. It's heavily used in custom filters when
grouping by `create_date`. So the goal of this PR is to add it back
in standard code.

Reference:
task-3263544

closes odoo/odoo#134313

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
Victor Piryns (pivi)
2023-10-06 14:33:40 +00:00
parent e38808e1a7
commit b01835ac63
+1 -1
View File
@@ -140,7 +140,7 @@ class Task(models.Model):
('04_waiting_normal', 'Waiting'),
], string='State', copy=False, default='01_in_progress', required=True, compute='_compute_state', inverse='_inverse_state', readonly=False, store=True, index=True, recursive=True, tracking=True)
create_date = fields.Datetime("Created On", readonly=True)
create_date = fields.Datetime("Created On", readonly=True, index=True)
write_date = fields.Datetime("Last Updated On", readonly=True)
date_end = fields.Datetime(string='Ending Date', index=True, copy=False)
date_assign = fields.Datetime(string='Assigning Date', copy=False, readonly=True,