Add index on id and lift

It can be used by the database to optimize the search of rules.

Closes #11843
This commit is contained in:
Cédric Krier
2022-12-30 13:59:04 +01:00
parent 670428ab10
commit ca7acae653
@@ -129,11 +129,16 @@ class ProductAssociationRule(ModelSQL, ModelView):
def __setup__(cls):
super().__setup__()
t = cls.__table__()
cls._sql_indexes.add(
Index(
t,
(t.lift, Index.Range(order='DESC')),
(t.conviction, Index.Range(order='ASC'))))
cls._sql_indexes.update({
Index(
t,
(t.lift, Index.Range(order='DESC')),
(t.conviction, Index.Range(order='ASC'))),
Index(
t,
(t.id, Index.Range()),
(t.lift, Index.Range(order='DESC'))),
})
def get_product_names(self, name):
return ', '.join(