Simplify bitmap updates in multivariate MCV code
authorTomas Vondra <tomas.vondra@postgresql.org>
Wed, 17 Jul 2019 16:16:50 +0000 (18:16 +0200)
committerTomas Vondra <tomas.vondra@postgresql.org>
Thu, 18 Jul 2019 09:29:38 +0000 (11:29 +0200)
commit7d24f6a49076f975ca87926b3cde8fdea3448ecb
tree51b9175fc39a2afc2d3fac511f7c4a54848dc98a
parente4deae7396f2a5576c0c8289e2bfc005ed3d6989
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
src/backend/statistics/mcv.c