| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Josh Berkus <josh(at)agliodbs(dot)com> |
| Cc: | 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-12 21:44:10 |
| Message-ID: | 8867.1418420650@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-performance pgsql-sql |
Josh Berkus <josh(at)agliodbs(dot)com> writes:
> Yeah, I believe the core problem is that Postgres currently doesn't have
> any way to have variadic return times from a function which don't match
> variadic input types. Returning a value as an actual numeric from JSONB
> would require returning a numeric from a function whose input type is
> text or json. So a known issue but one which would require a lot of
> replumbing to fix.
Well, it'd be easy to fix if we were willing to invent distinct operators
depending on which type you wanted out (perhaps ->> for text output as
today, add ->># for numeric output, etc). Doesn't seem terribly nice
from a usability standpoint though.
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.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Claudio Freire | 2014-12-12 22:10:29 | Re: [PERFORM] Re: querying with index on jsonb slower than standard column. Why? |
| Previous Message | Josh Berkus | 2014-12-12 21:24:04 | Re: Re: [SQL] querying with index on jsonb slower than standard column. Why? |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Claudio Freire | 2014-12-12 22:10:29 | Re: [PERFORM] Re: querying with index on jsonb slower than standard column. Why? |
| Previous Message | Josh Berkus | 2014-12-12 21:24:04 | Re: Re: [SQL] querying with index on jsonb slower than standard column. Why? |