details: https://code.tryton.org/tryton/commit/85d1f87af225
branch: default
user: Cédric Krier <[email protected]>
date: Tue Mar 31 13:51:29 2026 +0200
description:
Split indexes for history table to have either id or __id
815a0a887c3e added the index but the id and __id are just included to
the index
when the pre-filtering could be improved if id was in the index and the
window
order could be improved if the __id was in the index.
diffstat:
trytond/trytond/model/modelsql.py | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diffs (29 lines):
diff -r e131346274c3 -r 85d1f87af225 trytond/trytond/model/modelsql.py
--- a/trytond/trytond/model/modelsql.py Tue Mar 31 12:02:51 2026 +0200
+++ b/trytond/trytond/model/modelsql.py Tue Mar 31 13:51:29 2026 +0200
@@ -370,14 +370,22 @@
(history_table.id, Index.Equality())),
Index(
history_table,
+ (history_table.id, Index.Equality()),
(Coalesce(
history_table.write_date,
history_table.create_date),
Index.Range()),
order='DESC',
- include=[
- Column(history_table, '__id'),
- history_table.id]),
+ include=[Column(history_table, '__id')]),
+ Index(
+ history_table,
+ (Coalesce(
+ history_table.write_date,
+ history_table.create_date),
+ Index.Range()),
+ (Column(history_table, '__id'), Index.Range()),
+ order='DESC',
+ include=[history_table.id]),
})
@classmethod