I was just coming here to say exactly this. You could also use a partial index (that is, an index with a WHERE clause; so, "WHERE json_field LIKE '%foo.bar = baz%'" or whatever).
Re:Building a MongoDB Clone in Postgres
by jerrysievert on Monday June 04, 2012 @02:35PM
(#4065216)
you can, but in order to build a partial index, the function needs to be immutable. not exactly ideal in this case.
http://www.postgresql.org/docs/9.1/interactive/indexes-expre...