Skip to content

Instantly share code, notes, and snippets.

@brenogazzola
brenogazzola / gist:0f8d2dc191e217d5ce6e9293fa34e640
Created July 15, 2026 20:03
Rails + PostgreSQL Performance Audit Playbook
# Rails + PostgreSQL Performance Audit Playbook
A field-tested method for finding what's actually burning your database CPU, built for a
Rails monolith on managed PostgreSQL (Cloud SQL / RDS / etc.). It assumes no APM — just
`pg_stat_statements`, `pg_stat_activity`, and discipline. It pairs well with an LLM: point
one at this file plus your query results and let it do the attribution; the queries below
are ordered so a human can run them and paste results back.
## The core idea
@nz
nz / 1-sunspot-1.2-silent-fail.rb
Created December 30, 2010 20:59
Silently fail instead of raising an exception when an error occurs while writing to Solr.
###
#
# Custom write failure handling when there is an error writing to Solr.
# Install this in an initializer.
# Prints error messages to stderr.
#
# NOTE: does not fail for reads; you should catch those exceptions in your controller.
#
##