jsonb access operators inefficiency - Mailing list pgsql-hackers

From Teodor Sigaev
Subject jsonb access operators inefficiency
Date
Msg-id 5388891A.2030709@sigaev.ru
Whole thread Raw
Responses Re: jsonb access operators inefficiency  (Andrew Dunstan <andrew@dunslane.net>)
Re: jsonb access operators inefficiency  (Oleg Bartunov <obartunov@gmail.com>)
List pgsql-hackers
Hi!

jsonb operators ->text, ->>text,->int, ->>int use inefficient methods to access
to needed field, proportional O(N/2). Attached patch suggests for text operators
O(log(N)) and for integer - O(1). The fuctions with fast access already are
existed in current code and are used in contains operation, for example.
Attached patch uses that functions instead of sequentual loop over object/array.
--
Teodor Sigaev                                   E-mail: teodor@sigaev.ru
                                                    WWW: http://www.sigaev.ru/

Attachment

pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: Odd uuid-ossp behavior on smew and shearwater
Next
From: Steve Singer
Date:
Subject: Re: CREATE REPLICATION SLOT fails on a timeout