A relational algebra tree recomputes children before parent operators.
highlighted = computed this step
Compose operators bottom up
A composed query recomputes each child before the parent operator reads it. Changing an inner predicate can change the final cardinality. Note: the tree shows the recompute flow, and the table shows the final rows.
bottom up recompute
First composed query
The final recomputed row count is 2. Note: selection runs before join, and projection runs last.
final rows=2
set algebra not SQL bag/NULL, tiny finite tables, no product/perf claims
Second composed query
The same tree shape with a different inner predicate has recomputed row count 1. Note: a local predicate change can propagate to the final output.
final rows=1
set algebra not SQL bag/NULL, tiny finite tables, no product/perf claims
Summary
Composed relational algebra is honest because every parent consumes recomputed child outputs. Note: Bag or multiset duplicates and NULL behavior are deferred to the next book.