From: | Peter Geoghegan <pg(at)heroku(dot)com> |
---|---|
To: | Alexander Korotkov <aekorotkov(at)gmail(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: jsonb contains behaviour weirdness |
Date: | 2014-09-13 23:31:06 |
Message-ID: | CAM3SWZSw9VySSGt66eETz1bgTLs5gFMS29G6MhKU6Zeg7JHwCg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Sep 12, 2014 at 6:40 AM, Alexander Korotkov
<aekorotkov(at)gmail(dot)com> wrote:
> It's likely that "JB_ROOT_COUNT(val) < JB_ROOT_COUNT(tmpl)" should be
> checked only for objects, not arrays. Also, should JsonbDeepContains does
> same fast check when it deals with nested objects?
Attached patch implements something similar to what you describe here,
fixing your example.
I haven't added the optimization to JsonbDeepContains(). I think that
if anything, we should remove the optimization entirely, which is what
I've done -- an rhs "is it contained within?" value is hardly ever
going to be an object that has more pairs than the object we're
checking it is contained within. It's almost certainly going to have
far fewer pairs. Apart from only applying to objects, that
optimization just isn't an effective way of eliminating jsonb values
from consideration quickly. I'd rather not bother at all, rather than
having a complicated comment about why the optimization applies to
objects and not arrays.
--
Peter Geoghegan
Attachment | Content-Type | Size |
---|---|---|
remove_elems_optimization.patch | text/x-patch | 1.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2014-09-14 00:46:35 | Re: run xmllint during build (was Re: need xmllint on borka) |
Previous Message | Stephen Frost | 2014-09-13 23:00:34 | Re: A mechanism securing web applications in DBMS |