pgsql: Optimize allocations in bringetbitmap

From: Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Optimize allocations in bringetbitmap
Date: 2021-03-22 23:55:22
Message-ID: E1lOUOI-0007wM-5V@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Optimize allocations in bringetbitmap

The bringetbitmap function allocates memory for various purposes, which
may be quite expensive, depending on the number of scan keys. Instead of
allocating them separately, allocate one bit chunk of memory an carve it
into smaller pieces as needed - all the pieces have the same lifespan,
and it saves quite a bit of CPU and memory overhead.

Author: Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org>
Reviewed-by: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Reviewed-by: Mark Dilger <hornschnorter(at)gmail(dot)com>
Reviewed-by: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Reviewed-by: Masahiko Sawada <masahiko(dot)sawada(at)enterprisedb(dot)com>
Reviewed-by: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
Discussion: https://postgr.es/m/c1138ead-7668-f0e1-0638-c3be3237e812@2ndquadrant.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8e4b332e88b8339408a3aa8c62bc93d96b67c808

Modified Files
--------------
src/backend/access/brin/brin.c | 60 +++++++++++++++++++++++++++++++++---------
1 file changed, 47 insertions(+), 13 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2021-03-23 00:33:32 pgsql: Add macro RelationIsPermanent() to report relation permanence
Previous Message Tom Lane 2021-03-22 18:01:31 pgsql: Mostly-cosmetic adjustments of TOAST-related macros.