[Melbourne-pm] PostgreSQL and indexing with json types

Toby Corkindale toby.corkindale at strategicdata.com.au
Wed Oct 3 16:56:44 PDT 2012


Hi,
Just something interesting I noticed today..

As you've probably already seen, PostgreSQL 9.2 added support for 
storing JSON documents in a 'json' type field. It also adds the V8 
javascript engine as a first-class procedural language.

Initially I thought that you'd probably end up with a lot of tables with 
key metadata separated out into your int/char/etc types so you could 
index it.. but someone has pointed out that you can index into the json 
data using the v8 engine and Postgres' functional indexes.

That is reasonably nifty. Currently you need to write a couple of helper 
functions yourself, but I suspect we'll see more of this brought into 
the built-in functions by 9.3.

For examples, see:
http://people.planetpostgresql.org/andrew/index.php?/archives/249-Using-PLV8-to-index-JSON.html

Cheers,
Toby


More information about the Melbourne-pm mailing list