4 ms·
I think this will be really cool when we can index and query on parts of the JSON structure, similar to hstore.
by hiroprot 14y ago
I think this will be really cool when we can index and query on parts of the JSON structure, similar to hstore.
- __alexs 14y agoYou kind of can using partial function indexes already but it's not very flexible.
- fdr 14y agoplv8. https://code.google.com/p/plv8js/ Besides the obvious (such as projecting a sub-datum from a json datum), you can also do data transformations (whatever javascript can give you) -- as a contrived example, the sine of a number or the sum of two numbers -- and, you can try projecting arrays or hstores from a json and then using GIN/GiST to do a more expensive but more powerful index over them. A quick and dirty example from some time ago: https://gist.github.com/1152997 https://gist.github.com/1152997 Some more exotic built-in indexing will probably show up in the coming years, but a lot of things can be accomplished relatively soon with this extension.
- ibotty 14y agothat's right. plv8 works. but it certainly does not feel like using a postgres index but a map-without reduce-framework. so i hope that built-in indexing will come sooner than later... :D