DT

    Database Tuning & Optimization

    by Sheeyassh

    1

    Pinpoint slow queries, N+1 ORM loops, and missing indexes—then ship verified query rewrites, indexing plans, and caching patterns across SQL and MongoDB.

    $5

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    DT

    Database Tuning & Optimization

    Example session with this skill installed

    Our Django GraphQL endpoint orders/schema.py triggers 400+ queries per request and takes 1.8s when listing customer orders with line items and fulfillment status on PostgreSQL. Inspect orders/models.py, orders/schema.py, and our EXPLAIN ANALYZE output in docs/slow-order-query.txt to fix the N+1 and add the right indexes.

    • Read your context and instructions
    • Compiled the database tuning

    Updated orders/schema.py to batch line-item and fulfillment lookups using Prefetch and select_related, dropping per-request SQL queries from 412 to 4. Replaced OFFSET slicing in orders/querysets.py with keyset pagination on (created_at, id). Added orders/migrations/0014_order_lookup_idx.py creating a concurrent composite index on (customer_id, status, created_at DESC). Verified query budget compliance with pytest orders/tests/test_query_budget.py using assertNumQueries(4) and confirmed an index-only scan plan.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Pinpoint slow queries, N+1 ORM loops, and missing indexes—then ship verified query rewrites, indexing plans, and caching patterns across SQL and MongoDB. Diagnoses and resolves database performance bottlenecks across relational SQL engines, MongoDB, Django ORMs, GraphQL resolvers, and cloud deployments. It pairs execution-plan analysis with composite and partial indexing, N+1 query elimination, and multi-tier caching architectures to cut latency and connection saturation. Every change is anchored in measured query cost, index selectivity, and actual read/write workload patterns.

    What it does

    • Bottleneck & Execution Plan Audit Analyzes EXPLAIN (ANALYZE, BUFFERS) or MongoDB .explain('executionStats') outputs alongside ORM models and resolvers to rank sequential scans, N+1 loops, and lock contention.
    • Targeted Query, Index & Caching Refactor Rewrites slow queries (keyset pagination, covering indexes, DataLoader batching, select_related/prefetch_related) and wires Redis or read-replica caching with invalidation rules.
    • Workload Verification & Regression Guard Creates benchmark queries, CI query-count assertions, and monitoring thresholds (pg_stat_statements or profiler rules) to verify latency drops before deploy.
    • Deterministic Deliverables Delivers an execution-plan bottleneck report, concrete ORM or resolver query rewrites, non-blocking index definitions (CREATE INDEX CONCURRENTLY or MongoDB rolling indexes), caching and connection-pooling updates, and reproducible query-plan or query-count verification tests.

    How it works

    1. Pre-Flight & Scope Audit verifies workspace boundaries, inputs, and required tools (filesystem-read, filesystem-write, python3, shell-exec) before modifying any files.
    2. Core Workflow Execution runs Bottleneck & Execution Plan Audit, Targeted Query, Index & Caching Refactor using modular, non-destructive steps.
    3. Quality Gate Enforcement applies skill-specific checks including GraphQL Depth/Complexity Limiting & N+1 Prevention, PostgreSQL Query Plan & Migration Safety.
    4. Verification & Reporting validates every deliverable against the 7-point checklist and emits an evidence-backed summary.

    Frameworks & tools

    Supports aws, azure, ci/cd, django, gcp, graphql. Uses agent tools: filesystem-read, filesystem-write, python3, shell-exec. Prerequisites: Local DB or EXPLAIN plan dumps. Compatible with Claude Code, Cursor, Windsurf, Antigravity, Codex CLI, and MCP-enabled agents.

    Why this beats prompting it yourself

    Teams often bolt single-column indexes onto hot tables or slap Redis in front of broken queries without fixing the underlying sequential scan or N+1 fan-out. This skill reads your ORM models, resolvers, slow-query dumps, and EXPLAIN plans directly in the repository to align fixes with real access paths. It avoids regressions like redundant write-heavy indexes, unindexed sort keys causing disk spills, and cache stampedes under load. Instead of ad-hoc prompting, Database Tuning & Optimization enforces GraphQL Depth/Complexity Limiting & N+1 Prevention, PostgreSQL Query Plan & Migration Safety, Index Selectivity, Locking Safety & Backup Verification alongside a deterministic 7-point verification checklist.

    Use cases

    • Eliminating GraphQL resolver and Django ORM N+1 waterfalls using DataLoader batching and eager prefetching.
    • Replacing slow OFFSET pagination and sequential scans on SQL or MongoDB collections with keyset pagination and selective composite indexes.
    • Tuning connection pools, read-replica routing, and Redis cache-aside TTLs for bursty workloads on AWS, GCP, or Azure.
    • Pruning bloated or overlapping indexes that slow write throughput and inflate cloud storage IOPS.

    Known limitations

    Cannot inspect live cluster metrics unless EXPLAIN plans, pg_stat_statements snapshots, or MongoDB profiler logs are provided in the workspace. Hardware-level parameter sizing (such as shared_buffers or IOPS allocation) depends on cloud instance telemetry outside repository files. Index and caching trade-offs assume read/write ratios match the workload samples analyzed.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 6 days ago

    Software
    Local DB
    orEXPLAIN plan dumps

    Permissions

    No special permissions declared or detected

    Listed6 days ago

    What's inside

    Creator

    Sheeyassh

    Sheeyassh

    33 skills on Agensi

    Frequently Asked Questions

    SQL linters check syntax formatting only. This skill correlates your application ORM and GraphQL access paths with EXPLAIN execution stats, index selectivity, and caching patterns to remove real latency.

    It supports PostgreSQL, MySQL, MongoDB, Django ORMs, and GraphQL resolvers across AWS, GCP, and Azure workloads using any standard AI coding agent.

    You receive an execution-plan bottleneck report, refactored query or resolver code, non-blocking index migration scripts, caching/pooling patches, and query-budget verification tests.

    No live production access is needed. You can apply it incrementally to a single slow endpoint using local tests or pasted EXPLAIN plans and slow-query logs.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse All Claude Skills.