Re: Extract numeric filed in JSONB more effectively - Mailing list pgsql-hackers

From Andy Fan
Subject Re: Extract numeric filed in JSONB more effectively
Date
Msg-id CAKU4AWrap1zpYqunJwWTN=CdP7E8e0U4mYmwn7hvTW3ERuENVg@mail.gmail.com
Whole thread Raw
In response to Re: Extract numeric filed in JSONB more effectively  (jian he <jian.universality@gmail.com>)
Responses Re: Extract numeric filed in JSONB more effectively
List pgsql-hackers
Hi Jian:
 
return PointerGetDatum(v->val.numeric);
should be something like
PG_RETURN_NUMERIC(v->val.numeric);
?

Thanks for this reminder, a new patch is attached.  and commitfest
entry is added as well[1]. For recording purposes,  I compared the
new operator with all the existing operators.

select 1 from tb where (a->'a')::numeric = 2;   30.56ms
select 1 from tb where (a->>'a')::numeric = 2; 29.43ms
select 1 from tb where (a@->'a') = 2;              14.80ms 


--
Best Regards
Andy Fan
Attachment

pgsql-hackers by date:

Previous
From: Matt Smiley
Date:
Subject: Re: Configurable FP_LOCK_SLOTS_PER_BACKEND
Next
From: Peter Geoghegan
Date:
Subject: Re: Use of additional index columns in rows filtering