Module mz_transform::literal_constraints
source · Expand description
See if there are predicates of the form <expr>=literal
that can be sped up using an index.
More specifically, look for an MFP on top of a Get, where the MFP has an appropriate filter, and
the Get has a matching index. Convert these to IndexedFilter
joins, which is a semi-join with
a constant collection.
E.g.: Logically, we go from something like
SELECT f1, f2, f3 FROM t WHERE t.f1 = lit1 AND t.f2 = lit2
to
SELECT f1, f2, f3 FROM t, (SELECT * FROM (VALUES (lit1, lit2))) as filter_list WHERE t.f1 = filter_list.column1 AND t.f2 = filter_list.column2
Structs
Convert literal constraints into
IndexedFilter
joins.Statics
Functions
The above preparation might make the MFP more complicated, so we’ll later want to
either undo the preparation transformations or get back to
orig_mfp
.