Conducting Maintenance Tune-Ups
In earlier chapters, you saw active_record_doctor[250] and database_consistency[251] Ruby gems. These gems can be used to assist you in performing database maintenance. DatabaseConsistency has “Checkers” including a “RedundantIndexChecker” that can find redundant indexes.
The rails-pg-extras[252] gem can be used to find maintenance tasks. This gem checks for duplicate indexes, unused indexes, and bloat.
The gem also looks for null indexes, which are indexes that have a high proportion of NULL values. Null indexes could possibly be replaced by partial indexes that exclude NULL values. PostgreSQL 13 introduced index deduplication[253] that helps remove nulls from indexes.
Set up monitoring of key maintenance operations, ...
Get High Performance PostgreSQL for Rails now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.