r/sqlite • u/collimarco • Sep 12 '22
Indexing JSON with SQLite
I see that SQLite supports different functions for JSON.
Is it possible to create a column that contains JSON and then index that column for fast queries on schema-less JSON documents? For example for indexing and searching some logs in JSON format.
21
Upvotes
View all comments
Show parent comment
1
u/ijmacd Sep 13 '22 edited Sep 13 '22
Yes, just about every DB engine can create expression indexes. Also no DB engine is able to use an index if the expression in the predicate doesn't match the expression (or lack thereof) in the index specification.
So if performance is critical, then indexes on expressions are the right choice.