Remove overlapping indexes

This commit is contained in:
Cédric Krier
2023-05-22 12:13:48 +02:00
parent 6417fba801
commit 306eca6edb
2 changed files with 8 additions and 2 deletions
+1
View File
@@ -1,3 +1,4 @@
* Remove overlapping indexes
* Support subset operator between index definitions
* Add sum_tree helper
* Convert sum attribute into boolean
+7 -2
View File
@@ -505,10 +505,15 @@ class ModelSQL(ModelStorage):
@classmethod
def _update_sql_indexes(cls):
def no_subset(index):
for j in cls._sql_indexes:
if j != index and index < j:
return False
return True
if not callable(cls.table_query):
table_h = cls.__table_handler__()
# TODO: remove overlapping indexes
table_h.set_indexes(cls._sql_indexes)
indexes = filter(no_subset, cls._sql_indexes)
table_h.set_indexes(indexes)
@classmethod
def _update_history_table(cls):