Re: jsonb contains behaviour weirdness - Mailing list pgsql-hackers

From Tom Lane
Subject Re: jsonb contains behaviour weirdness
Date
Msg-id 1274.1410805794@sss.pgh.pa.us
Whole thread Raw
In response to Re: jsonb contains behaviour weirdness  (Peter Geoghegan <pg@heroku.com>)
Responses Re: jsonb contains behaviour weirdness
List pgsql-hackers
Peter Geoghegan <pg@heroku.com> writes:
> On Mon, Sep 15, 2014 at 11:12 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Personally I'd think that we should retain it for objects; Peter's
>> main argument against that was that the comment would be too complicated,
>> but that seems a bit silly from here.

> I just don't see any point to it. My argument against the complexity
> of explaining why the optimization is only used with objects is based
> on the costs and the benefits. I think the benefits are very close to
> nil.

It might be that the benefit is very close to nil; that would depend a lot
on workload, so it's hard to be sure.  I'd say though that the cost is
also very close to nil, in the sense that we're considering two additional
compare-and-branch instructions in a function that will surely expend
hundreds or thousands of instructions if there's no such short-circuit.

I've certainly been on the side of "that optimization isn't worth its
keep" many times before, but I don't think the case is terribly clear cut
here.  Since somebody (possibly you) thought it was worth having to begin
with, I'm inclined to follow that lead.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: jsonb contains behaviour weirdness
Next
From: Peter Geoghegan
Date:
Subject: Re: jsonb contains behaviour weirdness