jsonb access operators inefficiency

From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
To: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: jsonb access operators inefficiency
Date: 2014-05-30 13:35:22
Message-ID: 5388891A.2030709@sigaev.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/

Attachment Content-Type Size
jsonb_access.patch.gz application/x-tar 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Steve Singer 2014-05-30 13:35:33 Re: CREATE REPLICATION SLOT fails on a timeout
Previous Message Magnus Hagander 2014-05-30 11:23:09 Re: Odd uuid-ossp behavior on smew and shearwater