A WHERE condition applies a function to a column before comparing it with a constant

tx0/sql:function-on-columnstrictwarningperformance/algorithmicdepth fastperformance

What it finds

WHERE UPPER(email) = 'X' or WHERE YEAR(created) = 2024: a function applied to a column hides the column from its index, so the condition is checked on every row. A range on the bare column, or an index on the expression, lets the index work.

From the rule's source, function_on_column.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:function-on-column" = "warning"

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

tx0 explain tx0/sql:function-on-column shows the same in the terminal. Found a false positive? Report it.