The method of redundant index detection is based on the analysis of pg_index.indkey::text.
For tables with 10+ columns, straightforward LIKE can be wrong – for example,
"1 23" will match the line "1 2", which is incorrect.
The solution is to lpad all the numbers and work with 3-digit number sequences:
"010 023" and "001 002" for the example above (this pair won't match, as expected).
(In this PR, the code for this check was back-ported from postgres-checkup)
Derived from:
The method of redundant index detection is based on the analysis of pg_index.indkey::text.
For tables with 10+ columns, straightforward LIKE can be wrong – for example, "1 23" will match the line "1 2", which is incorrect.
The solution is to lpad all the numbers and work with 3-digit number sequences: "010 023" and "001 002" for the example above (this pair won't match, as expected).
(In this PR, the code for this check was back-ported from postgres-checkup)