How to make Sqlite use an index for ordering on multiple columns in the case of multiple selection from the same table?

后端 未结 1 1101
没有蜡笔的小新
没有蜡笔的小新 2021-01-17 01:58

I have a table with a few hundred thousand lines. (It’s a precomputed table expressing the relation between lemmas of words and other big tables.) I need to do multiple sele

相关标签:
1条回答
  • 2021-01-17 02:02

    An index can be used to speed up sorting only if the query allows to return the rows in the order in which they are stored in the index.

    This is not possible when another column with a different index is used to look rows up, or when you are returning multiple rows because of a cross join.

    Try adding an index on lemId, but this is unlikely to help with the sorting.

    The sorting is slow because there are too many result before the LIMIT.

    0 讨论(0)
提交回复
热议问题