From: David Rowley <drowley@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fixup some misusages of bms_num_members()
Date: Tue, 25 Aug 2020 22:52:16 +0000
Message-ID: <E1kAhnc-0006WR-0F@gemulon.postgresql.org> (raw)
Fixup some misusages of bms_num_members()
It's a bit inefficient to test if a Bitmapset is empty by counting all the
members and seeing if that number is zero. It's much better just to use
bms_is_empty(). Likewise for checking if there are at least two members,
just use bms_membership(), which does not need to do anything more after
finding two members.
Discussion: https://postgr.es/m/CAApHDvpvwm_QjbDOb5xga%2BKmX9XkN9xQavNGm3SvDbVnCYOerQ%40mail.gmail.com
Reviewed-by: Tomas Vondra
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/c34605daed563fcade07a9f45bcf440459599c00
Modified Files
--------------
src/backend/optimizer/path/clausesel.c | 3 +--
src/backend/statistics/dependencies.c | 8 ++++----
2 files changed, 5 insertions(+), 6 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: drowley@postgresql.org
Subject: Re: pgsql: Fixup some misusages of bms_num_members()
In-Reply-To: <E1kAhnc-0006WR-0F@gemulon.postgresql.org>
References: <E1kAhnc-0006WR-0F@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox