@@ -511,6 +511,8 @@ def generate_h004_redundant_indexes_report(self, cluster: str = "local", node_na
511511
512512redundant_indexes_by_db = {}
513513for db_name in databases :
514+ # Fetch index definitions from the sink for this database (used to aid remediation)
515+ index_definitions = self .get_index_definitions_from_sink (db_name )
514516# Query redundant indexes for each database using last_over_time to get most recent value
515517redundant_indexes_query = f'last_over_time(pgwatch_redundant_indexes_index_size_bytes{{cluster="{ cluster } ", node_name="{ node_name } ", dbname="{ db_name } "}}[10h])'
516518result = self .query_instant (redundant_indexes_query )
@@ -560,6 +562,7 @@ def generate_h004_redundant_indexes_report(self, cluster: str = "local", node_na
560562"table_size_bytes" :table_size_bytes ,
561563"index_usage" :index_usage ,
562564"supports_fk" :supports_fk ,
565+ "index_definition" :index_definitions .get (index_name ,'Definition not available' ),
563566"index_size_pretty" :self .format_bytes (index_size_bytes ),
564567"table_size_pretty" :self .format_bytes (table_size_bytes )
565568 }