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.
This commit is contained in:
Cédric Krier
2026-03-31 13:51:29 +02:00
parent a719345f7b
commit bcf8181107
+11 -3
View File
@@ -370,14 +370,22 @@ class ModelSQL(ModelStorage):
(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