From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Optimize JsonbContainerTypeName by reordering type checks |
Date: | 2025-09-08 13:27:29 |
Message-ID: | CAEoWx2n25k=amT2u_KY+Dk-UmV8GZiHfx=qpmh0RC=PTbAO+nA@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi Hacker,
This is an innocent refactor that doesn't change logic and improve
performance of jsonb_typeof() a little bit.
I have done a performance test that proves a tiny performance improvement:
With the master branch:
```
% pgbench -n --no-vacuum -T 120 -c 8 -j 4 -f test_jsonb_type.sql evantest
tps = 83290.213196 (without initial connection time)
# second run
tps = 83709.266846 (without initial connection time)
# third run
tps = 83531.014990 (without initial connection time)
```
With this patch:
```
% pgbench -n --no-vacuum -T 120 -c 8 -j 4 -f test_jsonb_type.sql evantest
tps = 84172.324715 (without initial connection time)
# second run
tps = 84082.619469 (without initial connection time)
# third run
tps = 84260.671778 (without initial connection time)
```
With 3 runs average tps, this patch makes ~0.8% improvement for
jsonb_typeof().
My test script is attached, it can run against any database. And attached
v2 patch file has a tiny change over v1.
Best regards,
Chao Li (Evan)
---------------------
HighGo Software Co., Ltd.
https://www.highgo.com/
Attachment | Content-Type | Size |
---|---|---|
test_jsonb_type.sql | application/octet-stream | 388 bytes |
v2-0001-jsonb-Optimize-JsonbContainerTypeName-by-reorderi.patch | application/octet-stream | 1.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2025-09-08 13:36:13 | Re: [PG19-3 PATCH] Don't ignore passfile |
Previous Message | Andrei Lepikhov | 2025-09-08 13:27:27 | Re: Query Performance Degradation Due to Partition Scan Order – PostgreSQL v17.6 |