Official docs don't throw any light on this. I want to index first n char on my column to save memory space. Is it even possible with sqlite? If so, How can I achieve that?
Asked
Active
Viewed 135 times
0
-
You can index a complete column – juergen d Sep 25 '17 at 10:39
1 Answers
0
You can put an index on an expression:
CREATE INDEX xxx ON MyTable(substr(MyColumn, 1, 10));
This index will be used only when a query expression matches the index expression, e.g.:
SELECT * FROM MyTable WHERE substr(MyColumn, 1, 10) = ?;
This feature requires SQLite 3.9 or later, which is available only in Android 7 ("Nougat") or later.

CL.
- 173,858
- 17
- 217
- 259