database-optimizer

Optimize PostgreSQL query performance, indexing, and migration safety in Drizzle ORM projects.

3|Updated Apr 18, 2026
One-click install
npx skills add https://github.com/garochee33/DSH --skill database-optimizer-garochee33
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-optimizer
Source: https://github.com/garochee33/DSH/tree/main/agents/skills/database-optimizer
Command: npx skills add https://github.com/garochee33/DSH --skill database-optimizer-garochee33

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you identify and fix slow database queries, inefficient indexes, and risky migration patterns so PostgreSQL-backed applications perform reliably under load.

Core Features & Use Cases

  • Query Performance Tuning: Improve slow selects, joins, grouping, and pagination patterns with better query structure.
  • Index Design: Add single, composite, and partial indexes to match common access patterns in Drizzle ORM schemas.
  • Migration Safety: Plan reversible migrations, backfills, and schema changes with less production risk.
  • Use Case: A dashboard endpoint is timing out because it scans millions of rows; this Skill guides you to add the right index, rewrite the query, and verify the performance gain.

Quick Start

Ask the database optimizer skill to review a slow PostgreSQL query and recommend the best index and migration-safe fix.

Frequently Asked Questions about database-optimizer

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

FAQPage Schema
How do I fix slow PostgreSQL queries in my Drizzle ORM application?

Fix slow PostgreSQL queries by rewriting inefficient selects and joins, then applying matching single or composite indexes to your Drizzle ORM schema to optimize data retrieval patterns under load.

What is the best way to design indexes for PostgreSQL pagination?

Design PostgreSQL pagination indexes by creating composite or partial indexes that match your sorting and filtering access patterns, preventing full table scans during offset or cursor pagination.

How do I plan reversible PostgreSQL migrations for large data backfills?

Plan reversible PostgreSQL migrations by structuring schema changes and data backfills incrementally, ensuring each step can roll back safely to reduce production risk during large data modifications.

Does this query optimization approach work with Drizzle ORM schemas?

Yes, this approach works directly with Drizzle ORM schemas, validating query patterns and applying efficient single, composite, and partial index strategies for PostgreSQL production reliability.

Why does my PostgreSQL dashboard endpoint time out scanning millions of rows?

Your PostgreSQL dashboard endpoint times out scanning millions of rows when missing indexes force full table scans; adding the right composite index and rewriting the query structure resolves the bottleneck.