accelerating a SQL quadruple self-join with a complex alternation in the WHERE clause
In case someone is interested, I answer my own question: since I reuse a large number of this filtered tables in several queries, I ended up precalculating them. This address both the readability and performance issues.