Re: [SQL] querying with index on jsonb slower than standard column. Why?
От | Tim Dudgeon |
---|---|
Тема | Re: [SQL] querying with index on jsonb slower than standard column. Why? |
Дата | |
Msg-id | 54861A81.8030509@gmail.com обсуждение исходный текст |
Ответ на | Re: [SQL] querying with index on jsonb slower than standard column. Why? (Adrian Klaver <adrian.klaver@aklaver.com>) |
Список | pgsql-performance |
On 08/12/2014 18:14, Adrian Klaver wrote:
I *think* this is the only way to do it presently?
Tim
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.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.
I *think* this is the only way to do it presently?
Tim
В списке pgsql-performance по дате отправления: