Re: json accessors

From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: json accessors
Date: 2012-12-05 18:48:41
Message-ID: 2C0EE42E-40EE-4F21-A360-21DC743590DA@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Dec 5, 2012, at 10:04 AM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:

> Indexing tree-like data isn't at all easy. We don't index XML either. There has been discussion of this sort of indexing it in the past, and a couple of people have said they would work on it, but I have not seen a proposal or a single line of code.

Yeah, I forgot that xmlpath was not indexable.

> Jsonpath on its own would not do what you're suggesting. A first approach to indexing treeish data requires that you generate all the possible paths and index that. That would be quite explosive in volume. And anyway, jsonpath is not on offer here.

Yeah, explosive for sure, but for sufficiently small JSON values, that shouldn’t be much of an issue. I expect GINs to be expensive anyway (see full-text indexing).

I am not invested in jsonpath; I just cited it as an example of using a single function call to do a nested search. Obviously `json_get(json, variadic text)` allows this, too, and could potentially use a GIN index of a JSON tree to perform the variadic text search at some point in the future, yes?

> I'm sorry what I have offered isn't what you want, but plenty of other people have told me it will go a long way meeting their needs.

*Sigh.* I guess I have not been clear.

The stuff you propose is *awesome*. I love it. The syntax with the chaining operators warms my heart, and I can’t wait to make *extensive* use of it in my procedural code. Maybe I would never *need* to do column queries of JSON contents often enough to require an expensive index.

So I'm happy with this stuff, as long as it does not get in the way of supporting indexing at some point in the future. I can’t wait to start using it!

Best,

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-12-05 18:48:53 Re: PITR potentially broken in 9.2
Previous Message Robert Haas 2012-12-05 18:47:28 Re: Dumping an Extension's Script