Lightweight Cardinality Estimation with Density
buttondown.com·9h
📇Index Selection
Preview
Report Post

Last week we talked about the different ways we can decompose a simple predicate which is a conjunction of two simpler predicates.

Given the query:

SELECT * FROM ab WHERE a = 7 AND b = 100

We can:

  • Not decompose the filter at all, and scan our base data applying the predicate a = 7 AND b = 100,
  • push down the a = 7 filter and translate the scan over the primary index into a scan on a secondary index, then apply the b = 100 filter on the results of that, or
  • do the same with the b = 100 filter and use a = 7 as our residual filter.

Algebraically these options might look something like:

Option 1

(filter (and (= a 7) (= b 100)) (scan ab PRIMARY))

Option 2

(filter (= b 100)...

Similar Posts

Loading similar posts...