A subquery of IN or EXISTS removes duplicates that do not matter

tx0/sql:distinct-in-subquerystrictwarningperformance/algorithmicdepth fastperformance

What it finds

x IN (SELECT DISTINCT y ...) and EXISTS (SELECT DISTINCT ...): the test does not care about duplicates, so DISTINCT only asks the database for a sort or hash it does not need.

From the rule's source, distinct_in_subquery.rs.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/sql:distinct-in-subquery" = "warning"

To keep one finding, suppress it with a reason: tx0 suppress ID --reason "..." writes the comment for it.

tx0 explain tx0/sql:distinct-in-subquery shows the same in the terminal. Found a false positive? Report it.