Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Sentry 6 min read Case study mediumAdept

Finding performance wins in our own traces with a coding agent

Pairing a coding agent with the Sentry MCP over Sentry's own production traces surfaced dozens of small backend fixes that together removed hundreds of millions of queries a week. Django SDK spans with SQL descriptions, query-source file/line attributes and user agents let the agent rank hot paths. Each SQL change was validated with EXPLAIN ANALYZE on a read-only Postgres mirror. Wins included splitting a GroupHistory ORDER BY/LIMIT query into per-status probes (935ms to 0.4ms), adding a missing pagination index, eager-loading related objects, batching cache writes with bulk_set, and skipping a needless UPDATE running ~10k/s. The post ends with example prompts for hunting N+1 queries and unindexed queries in your own app.

Related posts

  • Introducing Postgres Query Insights in ClickHouse Cloud

    ClickHouse mediumAdept

    Postgres Query Insights, now in preview for ClickHouse Cloud Managed Postgres, ranks every normalized query pattern by impact and aggregates per-execution counters (CPU, cache vs disk reads, temp spills, unlaunched parallel workers, WAL) to explain why a pattern is slow. A worked example traces a p99 regression to a sort spilling to disk, confirmed with EXPLAIN (ANALYZE, BUFFERS) and fixed with an index or work_mem tuning. Telemetry comes from pg_stat_ch, an Apache 2.0 extension that normalizes literals at parse-analyze time so values and PII never leave the database. It enqueues raw per-statement events via a non-blocking try-lock on a shared-memory ring buffer at about 3% overhead, dropping events under pressure rather than back-pressuring Postgres.

  • How Edgar Allan Poe found bugs in Turso

    Turso mediumAdept

    Turso runs LLM coding agents (Claude Code with the Ralph Loop plugin) for days at a time to autonomously find SQL correctness bugs. They use differential testing against SQLite as the oracle and prompts that steer agents toward complex code, unusual query shapes and away from happy paths. When long-running agents start going in circles, injecting entropy restores exploration: priming phrases (after the Recoding-Decoding paper) or arbitrary personas. Telling a stalled agent to act like Edgar Allan Poe produced 3 novel bugs within 5 minutes after an hour with none, so the team now runs parallel agents with different personas.

  • Operate with confidence: check production with your coding agent

    Supabase mediumAdept

    Supabase now ships Agent prompts that let a coding agent (Claude, Codex, Cursor) check a production project on a schedule for error spikes, security findings, slow queries and resource growth, reporting only new or worsening issues with the measured value, threshold and a next step. Setup connects the Supabase MCP server scoped to one project with read_only=true, then schedules a prompt; deduplication requires the agent tool to persist alert state between runs. The launch also adds a query_logs MCP tool for read-only SQL over 24 hours of logs, a debugging-aware supabase agent skill, a Health tab in Advisors for abnormal error rates, and a Database Connections page for finding and cancelling blocked or long-running queries.

  • Intelligent security at ClickHouse speed: How Cogent Security built an AI-native vulnerability management platform

    ClickHouse mediumAdept

    Cogent Security serves billions of vulnerability findings from per-tenant ClickHouse databases fed by a pipeline of entity resolution into a Knowledge Graph, dbt-built denormalized Iceberg tables, and the ClickHouse Spark Connector. Moving off Postgres cut P50/P90/P99 latency from 2s/5s/25s to 0.3s/0.9s/2.5s at 100M rows with no caching, driven by query-first table design, denormalization, projections, and per-column codecs. Their text-to-SQL Chart Agent rose from 40% accuracy single-shot to 94% through an agentic loop with RAG, live SQL execution, a golden query bank, tenant memory, and simpler queries over pre-computed ClickHouse projections. Evaluation compares data output rather than SQL strings, with three-run majority voting, and an in-house Ontology Service keeps schema semantics and per-tenant overlays in sync with the physical schema.

  • Building PlanetScale with Insights Agent

    PlanetScale mediumAdept

    PlanetScale ran its Insights Agent, which finds costly queries via Query Insights and opens fix PRs, against its own Rails API on MySQL. Reordering a Flipper feature-flag check cut 28.7M daily lookups to 8.3M, saving about 6.5 hours of database time per day. An agent-added index made a billing query slower because a normalized IN list hid 645 values and most calls returned zero rows. Filtering in Ruby instead cut database time about 14x, and the agent now checks rows read/returned per call and SQL size. A composite index on (ready, failed_at, created_at) brought a reconciliation job's queries from seconds to milliseconds.

The quest for software engineering knowledge.

Look:
Layout: