pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Build de-escaped JSON strings in larger chunks during lexing
3+ messages / 3 participants
[nested] [flat]

* pgsql: Build de-escaped JSON strings in larger chunks during lexing
@ 2022-07-11 04:15 John Naylor <john.naylor@postgresql.org>
  2022-07-11 22:15 ` Re: pgsql: Build de-escaped JSON strings in larger chunks during lexing Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: John Naylor @ 2022-07-11 04:15 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pgsql: Build de-escaped JSON strings in larger chunks during lexing
  2022-07-11 04:15 pgsql: Build de-escaped JSON strings in larger chunks during lexing John Naylor <john.naylor@postgresql.org>
@ 2022-07-11 22:15 ` Tom Lane <tgl@sss.pgh.pa.us>
  2022-07-12 00:43   ` Re: pgsql: Build de-escaped JSON strings in larger chunks during lexing John Naylor <john.naylor@enterprisedb.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2022-07-11 22:15 UTC (permalink / raw)
  To: John Naylor <john.naylor@postgresql.org>; +Cc: pgsql-committers@lists.postgresql.org

John Naylor <john.naylor@postgresql.org> writes:
> Build de-escaped JSON strings in larger chunks during lexing

It looks like this broke buildfarm member skink (valgrind).

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pgsql: Build de-escaped JSON strings in larger chunks during lexing
  2022-07-11 04:15 pgsql: Build de-escaped JSON strings in larger chunks during lexing John Naylor <john.naylor@postgresql.org>
  2022-07-11 22:15 ` Re: pgsql: Build de-escaped JSON strings in larger chunks during lexing Tom Lane <tgl@sss.pgh.pa.us>
@ 2022-07-12 00:43   ` John Naylor <john.naylor@enterprisedb.com>
  0 siblings, 0 replies; 3+ messages in thread

From: John Naylor @ 2022-07-12 00:43 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: John Naylor <john.naylor@postgresql.org>; pgsql-committers@lists.postgresql.org

On Tue, Jul 12, 2022 at 5:15 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> It looks like this broke buildfarm member skink (valgrind).

Looking...

-- 
John Naylor
EDB: http://www.enterprisedb.com





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2022-07-12 00:43 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-07-11 04:15 pgsql: Build de-escaped JSON strings in larger chunks during lexing John Naylor <john.naylor@postgresql.org>
2022-07-11 22:15 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-07-12 00:43   ` John Naylor <john.naylor@enterprisedb.com>

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