agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Tim Dudgeon <tdudgeon.ml@gmail.com>
Cc: pgsql-sql@postgresql.org
Cc: pgsql-performance@postgresql.org
Subject: Re: [SQL] querying with index on jsonb slower than standard column. Why?
Date: Mon, 08 Dec 2014 18:39:13 -0300
Message-ID: <54861A81.8030509@gmail.com> (raw)
In-Reply-To: <548614C8.90203@aklaver.com>
References: <5484DBDA.6090405@gmail.com>
	<5484EEA7.1030403@aklaver.com>
	<5484F437.2080402@gmail.com>
	<16147.1418002090@sss.pgh.pa.us>
	<5485C449.4020204@aklaver.com>
	<26002.1418053572@sss.pgh.pa.us>
	<5485C8BA.7040704@aklaver.com>
	<5485D584.8080105@aklaver.com>
	<27877.1418057764@sss.pgh.pa.us>
	<3936.1418071989@sss.pgh.pa.us>
	<548614C8.90203@aklaver.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

On 08/12/2014 18:14, Adrian Klaver wrote:
> Recheck Cond: ((((data ->> 'assay1_ic50'::text))::double precision > 90::double precision) AND (((data ->> 'assay2_ic50'::text))::double precision < 10::double precision))
> >
> >which means we have to pull the JSONB value out of the tuple, search
> >it to find the 'assay1_ic50' key, convert the associated value to text
> >(which is not exactly cheap because*the value is stored as a numeric*),
> >then reparse that text string into a float8, after which we can use
> >float8gt.  And then probably do an equivalent amount of work on the way
> >to making the other comparison.
> >
> >So this says nothing much about the lossy-bitmap code, and a lot about
> >how the JSONB code isn't very well optimized yet.  In particular, the
> >decision not to provide an operator that could extract a numeric field
> >without conversion to text is looking pretty bad here.
Yes, that bit seemed strange to me. As I understand the value is stored 
internally as numeric, but the only way to access it is as text and then 
cast back to numeric.
I *think* this is the only way to do it presently?

Tim

view thread (24+ messages)  latest in thread

Message-ID: <54861A81.8030509@gmail.com>
Permalink:  ../54861A81.8030509@gmail.com/
Also on:    postgresql.org/message-id/54861A81.8030509@gmail.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tdudgeon.ml@gmail.com, pgsql-performance@postgresql.org
  Subject: Re: [SQL] querying with index on jsonb slower than standard column. Why?
  In-Reply-To: <54861A81.8030509@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox