H*** Marry 2 kinds of reports: unused and redundant
TODO
-
When presenting the list of redundant indexes, show usage information about every redundant index, collecting it from all nodes (the master and all its replicas). -
Fix logic of Redundant Indexes report: -
compare index types / access methods (we must not suggest dropping gin
index claiming that its redundant tobtree
and vice versa); -
non of indexes are partial or they are both partial, with identical predicates; -
to ensure, that index access methods match, and both of them or none of them have the Unique option; -
if both indexes have Unique option, and one of them supports PK constraint, never suggest dropping it.
-
See also: https://gitlab.com/postgres-ai-team/postgres-health-check/issues/186
Acceptance criteria
As a DBA, I see is a redundant index being used or not, so I can conclude do I need to drop it.
Redundant indexes report doesn't detect PKs as "redundant" if identical (redundant) unique index is defined.
The report doesn't detect as redundant an index which is btree
, while the other one is gin
or of other type. And vice versa.
The report doesn't detect as redundant a partial index if the other index is not redundant or have different predicate. And vice versa.
Edited by Nikolay Samokhvalov