'{"order_id":555}' LIMIT 1; Indexing exact fields from json CREATE INDEX chats_id_meta_idx ON" />

PostgreSQL: using indices on json fields

It’s obviously a really bad idea.
But if you really need it, that’s what you can do.

Simple index on a field

Then you can get data like this:

Indexing exact fields from json

Then you should retrieve data like that:

Interesting links on topic

https://www.compose.com/articles/faster-operations-with-the-jsonb-data-type-in-postgresql/
https://stackoverflow.com/questions/36075918/postgresql-index-on-json
https://stackoverflow.com/questions/26499266/whats-the-proper-index-for-querying-structures-in-arrays-in-postgres-jsonb/

LEAVE A COMMENT