Skip to content

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

PlanetScale 5 min read Case study mediumAdept

Building PlanetScale with Insights Agent

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.

Assumes: MySQL composite indexesRails ActiveRecordquery execution plans

Related posts

  • How we improved availability through iterative simplification

    GitHub Engineering mediumAdept

    GitHub cut timeouts in its Rails monolith with small, measured changes found through Datadog metrics, Splunk logs and custom MySQL slow-query monitors. Each change was validated with Scientist experiments or rolled out gradually behind Flipper feature flags. Reordering a Command Palette query to look up a user's contributions before filtering by org removed a large IN clause and was 80-90% faster, and batching access checks added another 20-80% and 30-40%. Skipping unneeded authorization filters on a busy redirect endpoint cut tail latency and timeouts. Not every idea paid off: moving sorting into the application was 40-80% slower, so that experiment was dropped.

  • Timeseries indexing at scale

    Datadog Engineering mediumAdept

    Datadog replaced its timeseries index, which auto-generated materialized indexes from a log of slow queries, with an inverted index that unconditionally indexes every metric;tag pair, much like search engines map words to documents. The original Go service used SQLite for index definitions and the query log and RocksDB for Tagsets, Metrics and Indexes. It worked for predictable programmatic queries, but unpredictable user queries fell back to full scans, causing timeouts and manual index toil. The next-gen design drops SQLite, keeps RocksDB, and answers tag filters by intersecting posting lists of timeseries IDs. The two generations are compared on performance and reliability.

  • Finding performance wins in our own traces with a coding agent

    Sentry mediumAdept

    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.

  • 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.

  • What's new in ClickStack - May 2026

    ClickHouse easyNovice

    ClickStack's May 2026 update focuses on making dashboards useful during investigations. It adds configurable table row actions that link to templated searches or other dashboards, scoped multi-source filters, threshold-colored number tiles, and a service map with p50/p95/p99 latency, throughput, Lucene/SQL filtering and a focus mode. Other additions include experimental PromQL support built on the ClickHouse TimeSeries Engine, a Browser RUM dashboard template, a split-pane trace view, configurable event-pattern columns, and new MCP tools for agents. The direct-read attribute search optimization, measured at 1.4x–10x faster, is now on by default because it works with ALIAS columns and no longer needs extra storage.

The quest for software engineering knowledge.

Look:
Layout: