pgsql: Use multi-inserts for pg_enum

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Use multi-inserts for pg_enum
Date: 2022-11-16 03:43:09
Message-ID: E1ov9KP-000Olt-3I@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use multi-inserts for pg_enum

This allows to insert at once all the enum values defined with a given
type into pg_enum, reducing the WAL produced by roughly 10%~. pg_enum's
indexes are opened and closed now once rather than N times. The number
of items to insert is known in advance, making this change
straight-forward, and would happen on a CREATE TYPE .. AS ENUM.

The amount of data inserted is capped at 64kB for each insert batch.
This is similar to commits 63110c6 and e3931d01, that worked on
different catalogs.

Reported-by: Ranier Vilela
Author: Michael Paquier
Reviewed-by: Kyotaro Horiguchi, Ranier Vilela
Discussion: https://postgr.es/m/Y3M5bovrkTQbAO4W@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1ff416121884884a167f0974cea9f86a1d6a577f

Modified Files
--------------
src/backend/catalog/pg_enum.c | 55 +++++++++++++++++++++++++++++++++----------
1 file changed, 42 insertions(+), 13 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Jeff Davis 2022-11-16 04:08:13 pgsql: Fix test in ae168c794f, per buildfarm.
Previous Message Michael Paquier 2022-11-16 01:50:53 pgsql: Avoid some overhead with open and close of catalog indexes