relational
relational copied to clipboard
Remove common subexpressions here
empty = πroom(σ id is None (people ⧓ person_room ⧓ rooms))
full = πroom(σ r==room and i != id ( πr,i (ρ room➡r, id➡i ( people ⧓ person_room ⧓ rooms )) * π room,id (people ⧓ person_room⧓rooms)))
πroom (rooms) - empty - full ⋈ person_room ⋈ people
The same joins are performed multiple times and will not be optimised, which was the entire point of the multiline optimizations.