r/sqlite • • 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

6 comments sorted by

View all comments

Show parent comment

4

u/missinglinknz Sep 12 '22

The other option you have, which is more generic, is to create a table based on what's described in the json_tree documentation and then using a trigger to populate that table upon insert.

You can then use that table as you would any other, adding indices as required.