Posted Sep 12, 2012 9:32 UTC (Wed) by andresfreund (subscriber, #69562)
In reply to: Why json by ringerc
Parent article: PostgreSQL 9.2 released
> Indexing, like hstore currently has
Its easier for hstore because hstore isn't nested and not individually typed (everything is a string).
An efficient index over arbitrary nesting and several types isn't exactly easy and I am not that sure that will come that soon. An opclass for not-nested json objects or such would be relatively easy though.
Posted Sep 12, 2012 10:29 UTC (Wed) by yodermk (subscriber, #3803)
[Link]
MongoDB has something very much like that.
Why json
Posted Sep 12, 2012 10:42 UTC (Wed) by ringerc (subscriber, #3071)
[Link]
Once there's a json lookup operator (say implementing the [] operator for json to get the value of a key, or a path lookup function kind of like xpath provides for xml) then a functional index might be reasonably practical, at least if the result is a scalar.
Right now the lack of the concept of a "scalar json value" (due to an IMO over-eager interpretation of the JSON "spec") is frustrating all sorts of things, including proper json constructor functions.
More general indexing might be done through GiST, but I imagine it'd be a pretty complicated job involving extracting paths-to-values.