Why is writing JSONB faster than just JSON?

From: Mitar <mmitar(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Why is writing JSONB faster than just JSON?
Date: 2021-04-14 06:38:04
Message-ID: CAKLmikORKREgCE8F69NUcbi6aSo-ZrU75P0Jb8adaqpEVqS0Kg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

I have a project where we among other data want to store static JSON
objects which can get pretty large (10-100 KB). I was trying to
evaluate how it would work if we simply store it as an additional
column in a PostgreSQL database. So I made a benchmark [1]. The
results surprised me a bit and I am writing here because I would like
to understand them. Namely, it looks like writing into a jsonb typed
column is 30% faster than writing into a json typed column. Why is
that? Does not jsonb require parsing of JSON and conversion? That
should be slower than just storing a blob as-is?

[1] https://gitlab.com/mitar/benchmark-pg-json

Mitar

--
http://mitar.tnode.com/
https://twitter.com/mitar_m

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dmitry Dolgov 2021-04-14 08:48:45 Re: Why is writing JSONB faster than just JSON?
Previous Message Kevin Brannen 2021-04-13 20:38:24 RE: [Extern] Re: Advice on binary installation