Re: Use merge-based matching for MCVs in eqjoinsel

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ilia Evdokimov <ilya.evdokimov@tantorlabs.com>
Cc: David Geier <geidav.pg@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2025-11-17T18:44:33Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Speed up eqjoinsel() with lots of MCV entries.

I wrote:
> Actually, after sleeping on it it seems like the obvious thing is
> to test "sslot1.nvalues * sslot2.nvalues", since the work we are
> thinking about saving scales as that product.  But I'm not sure
> what threshold value to use if we do that.  Maybe around 10000?

Or maybe better, since we are considering an O(m*n) algorithm
versus an O(m+n) one, we could check whether

sslot1.nvalues * sslot2.nvalues - (sslot1.nvalues + sslot2.nvalues)

exceeds some threshold.  But that doesn't offer any insight into
just what the threshold should be, either.

			regards, tom lane