cockroach
cockroach copied to clipboard
opt: remove TableMeta.IsSkipLocked
opt: fix duplicate join multiplicity test
Test case 9 in TestGetJoinMultiplicity was a duplicate of test case 2.
It has been updated to be similar, but use an INNER JOIN instead of a
LEFT JOIN, which I believe it was originally supposed to be - there is
no similar existing test case.
Release note: None
opt: remove TableMeta.IsSkipLocked
TableMeta.IsSkipLocked was used by the multiplicity builder to
determine whether a column was filtered or not by a SKIP LOCKED scan.
However, this field was unnecessary. The deriveUnfilteredCols function
in the multiplicity builder already traverses expressions all the way
down to ScanExprs, only collecting unfiltered columns if they
originate from a scan where ScanExpr.IsUnfiltered returns true.
ScanExpr.IsUnfiltered returns false if the scan is a SKIP LOCKED
scan. Therefore, no additional mechanism is required to detect columns
filtered by SKIP LOCKED scans.
I noticed that TableMeta.IsSkipLocked was not needed because the
multiplicity builder unit tests added in #85720 never set it, yet the
tests passed.
This commit also adds more multiplicity builder unit tests for
self-joins with SKIP LOCKED.
Release note: None
opt: ensure min cardinality of zero for expressions with SKIP LOCKED
This commit ensures that the minimum cardinality of a scan or
lookup-join with SKIP LOCKED is zero. This shouldn't be needed because
the logical to derive the cardinality for these expressions should never
produce a non-zero minimum cardinality, but this provides extra safety.
Release note: None
Yes! It was already added in #85720.
Ah, thanks.. I didn't see it. I was reviewing code in a branch that's a few days old.
bors r+
bors r+