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

I haven't tried it, but I think you would be able to use a PostgreSQL functional index (i.e. indexing the result of a function call to extract a particular bit of data from the JSON.)

http://www.postgresql.org/docs/9.1/interactive/indexes-expre...



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).


you can, but in order to build a partial index, the function needs to be immutable. not exactly ideal in this case.


Immutability is perfectly appropriate for that use-case, though. Creating an index via a function that may return different outputs when provided the same input is always going to lose.




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

Search: