MCPcopy
hub / github.com/tortoise/tortoise-orm / force_index

Method force_index

tortoise/queryset.py:993–1003  ·  view source on GitHub ↗

The FORCE INDEX hint acts like USE INDEX (index_list), with the addition that a table scan is assumed to be very expensive.

(self, *index_names: str)

Source from the content-addressed store, hash-verified

991 return queryset
992
993 def force_index(self, *index_names: str) -> QuerySet[MODEL]:
994 """
995 The FORCE INDEX hint acts like USE INDEX (index_list),
996 with the addition that a table scan is assumed to be very expensive.
997 """
998 if self.capabilities.support_index_hint:
999 queryset = self._clone()
1000 for index_name in index_names:
1001 queryset._force_indexes.add(index_name)
1002 return queryset
1003 return self
1004
1005 def use_index(self, *index_names: str) -> QuerySet[MODEL]:
1006 """

Callers 7

_make_queryMethod · 0.80
_make_queryMethod · 0.80
_make_queryMethod · 0.80
_make_queryMethod · 0.80
_make_queryMethod · 0.80
test_force_indexFunction · 0.80

Calls 2

_cloneMethod · 0.95
addMethod · 0.80

Tested by 2

test_force_indexFunction · 0.64