pgsql: Cache argument type information in json(b) aggregate functions.

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Cache argument type information in json(b) aggregate functions.
Date: 2015-09-18 18:45:55
Message-ID: E1Zd0fT-0006BS-9F@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Cache argument type information in json(b) aggregate functions.

These functions have been looking up type info for every row they
process. Instead of doing that we only look them up the first time
through and stash the information in the aggregate state object.

Affects json_agg, json_object_agg, jsonb_agg and jsonb_object_agg.

There is plenty more work to do in making these more efficient,
especially the jsonb functions, but this is a virtually cost free
improvement that can be done right away.

Backpatch to 9.5 where the jsonb variants were introduced.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/c00c3249e3247d24751d97ff6f26603810593414

Modified Files
--------------
src/backend/utils/adt/json.c | 125 ++++++++++++++++------------
src/backend/utils/adt/jsonb.c | 181 ++++++++++++++++++++++-------------------
2 files changed, 173 insertions(+), 133 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Jeff Janes 2015-09-18 20:20:36 Re: [COMMITTERS] pgsql: Add pages deleted from pending list to FSM
Previous Message Tom Lane 2015-09-18 17:55:44 pgsql: Fix low-probability memory leak in regex execution.