May 2018
Intermediate to advanced
576 pages
30h 25m
English
The following query will list all invalid indexes, if any:
SELECT ir.relname AS indexname , it.relname AS tablename , n.nspname AS schemaname FROM pg_index i JOIN pg_class ir ON ir.oid = i.indexrelid JOIN pg_class it ON it.oid = i.indrelid JOIN pg_namespace n ON n.oid = it.relnamespace WHERE NOT i.indisvalid;
Take note of these indexes, so that later you can tell whether a given index is invalid because we marked it as invalid during this recipe, in which case it can safely be marked as valid, or because it was already invalid for other reasons.