4 ms·
No matter how fast the parsing is — queries are going to be slow. For example, on 1M rows table with very simple flat JSON values like these: {"object": "
by nalgeon 4y ago
No matter how fast the parsing is — queries are going to be slow.
For example, on 1M rows table with very simple flat JSON values like these:
{"object": "user", "object_id": 10, "action": "login"}
Without index, this query is going to take 500ms or more:
select * from events where json_extract(value, '$.object_id') = ?;
With index on json_extract(value, '$.object_id'), it is going to take 1ms.
See for yourself:
https://sqlime.org/#gist:c452550ae694382f32188bc29412b24a https://sqlime.org/#gist:c452550ae694382f32188bc29412b24a
- simonw 4y agoNot disagreeing with you that indexes are a great idea here - but 500ms is fast enough for a LOT of cases.
- naikrovek 4y agoand it's too slow for all others. I learned a lot from that interactive SQLite thing and I'm glad I didn't just let myself believe that 500ms was ok. (I'm not saying that you just default to a "slow is ok" stance, I'm just saying I'm glad I didn't. this is the internet, where everyone misunderstands me and pretends I say things I don't, so I need to be explicit, sometimes.)