Re: Re: [SQL] querying with index on jsonb slower than standard column. Why?

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, Tim Dudgeon <tdudgeon(dot)ml(at)gmail(dot)com>, pgsql-sql(at)postgresql(dot)org, pgsql-performance(at)postgresql(dot)org
Subject: Re: Re: [SQL] querying with index on jsonb slower than standard column. Why?
Date: 2014-12-13 03:05:20
Message-ID: 548BACF0.5040909@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance pgsql-sql


On 12/12/2014 08:20 PM, Tom Lane wrote:
> We can't just add the operator and worry about usability later;
> if we're thinking we might want to introduce such an automatic
> transformation, we have to be sure the new operator is defined in a
> way that allows the transformation to not change any semantics.
> What that means in this case is that if (jsonb ->> 'foo')::numeric
> would have succeeded, (jsonb ->># 'foo') has to succeed; which means
> it'd better be willing to attempt conversion of string values to
> numeric, not just throw an error on sight.
>
>

Well, I'm not 100% convinced about the magic transformation being a good
thing.

Json numbers are distinct from strings, and part of the justification
for this is to extract a numeric datum from jsonb exactly as stored, on
performance grounds. So turning round now and making that turn a string
into a number if possible seems to me to be going in the wrong direction.

cheers

andrew

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Claudio Freire 2014-12-13 05:38:41 Re: Re: [SQL] querying with index on jsonb slower than standard column. Why?
Previous Message Tom Lane 2014-12-13 01:20:37 Re: Re: [SQL] querying with index on jsonb slower than standard column. Why?

Browse pgsql-sql by date

  From Date Subject
Next Message Claudio Freire 2014-12-13 05:38:41 Re: Re: [SQL] querying with index on jsonb slower than standard column. Why?
Previous Message Tom Lane 2014-12-13 01:20:37 Re: Re: [SQL] querying with index on jsonb slower than standard column. Why?