Re: Re: [SQL] querying with index on jsonb slower than standard column. Why? - Mailing list pgsql-performance

From Claudio Freire
Subject Re: Re: [SQL] querying with index on jsonb slower than standard column. Why?
Date
Msg-id CAGTBQpZDYYF+UYgFQrKUutGk1pHJ2i0m7DS8sgte0GyZf7A8tg@mail.gmail.com
Whole thread Raw
In response to Re: Re: [SQL] querying with index on jsonb slower than standard column. Why?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
On Fri, Dec 12, 2014 at 6:44 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> The usability issue could be fixed by teaching the planner to fold a
> construct like (jsonb ->> 'foo')::numeric into (jsonb ->># 'foo').
> But I'm not sure how we do that except in a really ugly and ad-hoc
> fashion.

It would be doable if you could have polymorphism on return type, and
teach the planner to interpret (jsonb ->> 'foo')::numeric as the
operator with a numeric return type.

That's a trickier business even, but it could be far more useful and
generically helpful than ->>#.

Tricky part is what to do when the cast is missing.


pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Re: [SQL] querying with index on jsonb slower than standard column. Why?
Next
From: Andrew Dunstan
Date:
Subject: Re: Re: [SQL] querying with index on jsonb slower than standard column. Why?