From: John Naylor <john.naylor@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Build de-escaped JSON strings in larger chunks during lexing
Date: Mon, 11 Jul 2022 04:15:20 +0000
Message-ID: <E1oAkpK-002DWJ-IK@gemulon.postgresql.org> (raw)
Build de-escaped JSON strings in larger chunks during lexing
During COPY BINARY with large JSONB blobs, it was found that half
the time was spent parsing JSON, with much of that spent in separate
appendStringInfoChar() calls for each input byte.
Add lookahead loop to json_lex_string() to allow batching multiple bytes
via appendBinaryStringInfo(). Also use this same logic when de-escaping
is not done, to avoid code duplication.
Report and proof of concept patch by Jelte Fennema, reworked by Andres
Freund and John Naylor
Discussion: https://www.postgresql.org/message-id/CAGECzQQuXbies_nKgSiYifZUjBk6nOf2%3DTSXqRjj2BhUh8CTeA%40mail.g...
Discussion: https://www.postgresql.org/message-id/flat/PR3PR83MB0476F098CBCF68AF7A1CA89FF7B49@PR3PR83MB0476.EURP...
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/3838fa269c15706df2b85ce2d6af8aacd5611655
Modified Files
--------------
src/common/jsonapi.c | 58 +++++++++++++++++++++++++++++++++++-----------------
1 file changed, 39 insertions(+), 19 deletions(-)
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: john.naylor@postgresql.org
Subject: Re: pgsql: Build de-escaped JSON strings in larger chunks during lexing
In-Reply-To: <E1oAkpK-002DWJ-IK@gemulon.postgresql.org>
References: <E1oAkpK-002DWJ-IK@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox