pgsql: Simplify bitmap updates in multivariate MCV code

From: Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Simplify bitmap updates in multivariate MCV code
Date: 2019-07-18 09:30:00
Message-ID: E1ho2jg-0004Dy-Lk@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Simplify bitmap updates in multivariate MCV code

When evaluating clauses on a multivariate MCV list, we build a bitmap
tracking how the clauses match each item of the MCV list. When updating
the bitmap we need to consider the current value (tracking how the item
matches preceding clauses), match for the current clause and whether the
clauses are connected by AND or OR.

Until now the logic was copied on every place updating the bitmap, which
was not quite readable. So just move it to a separate function and call
it where needed.

Backpatch to 12, where the code was introduced. While not a bugfix, this
should make maintenance and future backpatches easier.

Discussion: https://postgr.es/m/8736jdhbhc.fsf%40ansel.ydns.eu

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7d24f6a49076f975ca87926b3cde8fdea3448ecb

Modified Files
--------------
src/backend/statistics/mcv.c | 123 +++++++++++++++++--------------------------
1 file changed, 47 insertions(+), 76 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tomas Vondra 2019-07-18 09:30:28 pgsql: Fix handling of opclauses in extended statistics
Previous Message Andres Freund 2019-07-18 02:51:50 pgsql: tableam: comment improvements.