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

Method use_index

tortoise/queryset.py:1005–1014  ·  view source on GitHub ↗

The USE INDEX (index_list) hint tells MySQL to use only one of the named indexes to find rows in the table.

(self, *index_names: str)

Source from the content-addressed store, hash-verified

1003 return self
1004
1005 def use_index(self, *index_names: str) -> QuerySet[MODEL]:
1006 """
1007 The USE INDEX (index_list) hint tells MySQL to use only one of the named indexes to find rows in the table.
1008 """
1009 if self.capabilities.support_index_hint:
1010 queryset = self._clone()
1011 for index_name in index_names:
1012 queryset._use_indexes.add(index_name)
1013 return queryset
1014 return self
1015
1016 def prefetch_related(self, *args: str | Prefetch) -> QuerySet[MODEL]:
1017 """

Callers 7

_make_queryMethod · 0.80
_make_queryMethod · 0.80
_make_queryMethod · 0.80
_make_queryMethod · 0.80
_make_queryMethod · 0.80
test_use_indexFunction · 0.80

Calls 2

_cloneMethod · 0.95
addMethod · 0.80

Tested by 2

test_use_indexFunction · 0.64