Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

We have a collection of semi-structured data that we've been storing with the JSON features in 9.3.

Very cool to build a full text search index based on things inside of JSON fields with about 10 minutes of time.



can you do a normal index on JSON though? I guess you can with the function based indexes. 9.3 actually makes JSON meaningful in Postgres since you can actually query it now. But there are no write operations, so MongoDB is still a ton nicer here with its atomic modifiers like $push.


> can you do a normal index on JSON though?

Yes, using the ->> operator you should be able to create an index on a JSON field, e.g.

   CREATE INDEX ON table ((field->>'thing'))
(an index on a JSON column makes no more sense than on e.g. an hstore column)


Indexing on JSON columns is key to storing semi-structured data with JSON. It's fairly useless without, for anything but small amounts of data.


I'm not sure what you mean, could you clarify/expand on your comment?




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: