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)
| 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 | """ |