Making Bitmapsets be valid Nodes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Amit Langote <amitlangote09(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Subject: Making Bitmapsets be valid Nodes
Date: 2022-11-11 20:05:58
Message-ID: 109089.1668197158@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Per the discussion at [1], it seems like it'd be a good idea to make
Bitmapsets into full-fledged, tagged Nodes, so that we could do things
like print or copy lists of them without special-case logic. The
extra space for the NodeTag is basically free due to alignment
considerations, at least on 64-bit hardware.

Attached is a cleaned-up version of Amit's patch v24-0003 at [2].
I fixed the problems with not always tagging Bitmapsets, and changed
the outfuncs/readfuncs logic so that Bitmapsets still print exactly
as they did before (thus, this doesn't require a catversion bump).

As proof of concept, I removed the read_write_ignore labels from
RelOptInfo's unique_for_rels and non_unique_for_rels fields, and
got nice-looking debug printout:

:unique_for_rels ((b 1))
:non_unique_for_rels <>

I also removed some special-case code from indxpath.c because
list_member() can do the same thing now. (There might be other
places that can be simplified; I didn't look very hard.)

It'd be possible to make Bitmapset fields be (mostly) not special cases
in the copy/equal/out/read support. But I chose to leave that alone,
because it'd add a little runtime overhead for indirecting through the
generic support functions while not really saving any code space.

Barring objections, I'd like to go ahead and push this.

regards, tom lane

[1] https://www.postgresql.org/message-id/94353655-c177-1f55-7afb-b2090de33341%40enterprisedb.com
[2] https://www.postgresql.org/message-id/CA%2BHiwqEYCLRZ2Boq_uK0pjLn_9b8XL-LmwKj7HN5kJOivUkYLg%40mail.gmail.com

Attachment Content-Type Size
v1-0001-make-Bitmapsets-be-valid-Nodes.patch text/x-diff 10.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2022-11-11 22:14:10 Document WAL rules related to PD_ALL_VISIBLE in README
Previous Message Imseih (AWS), Sami 2022-11-11 19:10:16 Re: Add index scan progress to pg_stat_progress_vacuum