agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Josh Berkus <josh@agliodbs.com>
Cc: Tim Dudgeon <tdudgeon.ml@gmail.com>
Cc: pgsql-sql@postgresql.org
Cc: pgsql-performance@postgresql.org
Subject: Re: Re: [SQL] querying with index on jsonb slower than standard column. Why?
Date: Fri, 12 Dec 2014 22:05:20 -0500
Message-ID: <548BACF0.5040909@dunslane.net> (raw)
In-Reply-To: <15863.1418433637@sss.pgh.pa.us>
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>
	<54861A81.8030509@gmail.com>
	<WM!10a58876093961b15d913f3acfd3ae6e8f5f3f7b48bfbafc745c1350051f176f2eb1f0d024840ed24712614adf91b2b6!@asav-3.01.com>
	<548B5CF4.4030009@agliodbs.com>
	<8867.1418420650@sss.pgh.pa.us>
	<548B79E3.5070301@dunslane.net>
	<15863.1418433637@sss.pgh.pa.us>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>


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


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (24+ messages)  latest in thread

Message-ID: <548BACF0.5040909@dunslane.net>
Permalink:  ../548BACF0.5040909@dunslane.net/
Also on:    postgresql.org/message-id/548BACF0.5040909@dunslane.net

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: andrew@dunslane.net, tgl@sss.pgh.pa.us, josh@agliodbs.com, tdudgeon.ml@gmail.com, pgsql-performance@postgresql.org
  Subject: Re: Re: [SQL] querying with index on jsonb slower than standard column. Why?
  In-Reply-To: <548BACF0.5040909@dunslane.net>

* 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