convex-performance-audit

Diagnoses and fixes Convex read amplification, subscription cost, OCC conflicts, and function budget issues.

Updated Aug 12, 2026
One-click install
npx skills add https://github.com/JuanQuenga/statsconnect --skill convex-performance-audit-juanquenga
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: convex-performance-audit
Source: https://github.com/JuanQuenga/statsconnect/tree/main/apps/clashcrown/.agents/skills/convex-performance-audit
Command: npx skills add https://github.com/JuanQuenga/statsconnect --skill convex-performance-audit-juanquenga

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Convex applications slow down as tables grow: queries scan too many documents, subscriptions invalidate too often, mutations hit OCC conflicts, and functions approach execution limits. This Skill provides a structured audit workflow that turns vague "it's slow" reports into concrete, verified fixes. ## Core Features & Use Cases - Signal-driven diagnosis: Starts from npx convex insights --details, dashboard health data, or a code audit, then routes each symptom to a matching reference guide. - Four problem-class playbooks: Reference files cover hot-path read amplification and indexes, OCC write contention, subscription and invalidation cost, and function execution/transaction budgets. - Sibling-function consistency: After fixing one function, the workflow audits sibling readers and writers on the same tables so old patterns do not linger. - Use Case: A dashboard page feels sluggish and insights show high bytes read. The Skill traces the query's full read set, replaces a scan-plus-filter with an indexed digest-table read, removes Date.now() from the query, and verifies no sibling queries repeat the pattern. ## Quick Start Ask the assistant to audit your Convex app for performance issues, starting with the strongest available signal such as insights output or a slow page.

Frequently Asked Questions about convex-performance-audit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I diagnose slow Convex queries?▼

Run `npx convex insights --details` to find functions with high bytes read or documents read, then trace every `ctx.db.get` and `ctx.db.query` in the affected path. Replace scan-plus-filter patterns with `withIndex` queries and consider digest tables for hot list pages.

How do I fix OCC conflicts in Convex mutations?▼

OCC conflicts come from write contention on hot documents or broad read sets. Narrow reads with indexes, shard hot counters across multiple documents, and move non-critical bookkeeping to scheduled functions via `ctx.scheduler.runAfter`.

Why does Convex .filter() not improve query performance?▼

The Convex `.filter()` method runs after the database scan, so you still pay for every document read, identical to filtering in JavaScript. Only `.withIndex()` and `.withSearchIndex()` push predicates to the storage layer and reduce documents scanned.

When should I use point-in-time reads instead of useQuery?▼

Use point-in-time reads for high-read, low-freshness flows like reports, aggregate snapshots, and low-churn listings where explicit refresh is acceptable. Keep reactive `useQuery` subscriptions for collaborative editing, live dashboards, and presence-heavy views.

What are the Convex function execution limits?▼

Queries and mutations get 1 second of user-code execution, 16 MiB read and written per transaction, and 32,000 documents scanned. Actions get 10 minutes. Break large mutations into cursor-based self-scheduling batches to stay within these budgets.

When should I not restructure my Convex schema for performance?▼

Avoid digest tables, document splitting, and migration-heavy rollouts when tables are small, traffic is modest, or signals are weak. A simple scan on a small table is often acceptable, and structural work should follow a measured signal or a clearly unbounded hot path.