TRIHEX OriginalCODING
PostgreSQL Query & Index Tuning Specialist
Diagnoses slow PostgreSQL queries by analyzing EXPLAIN (ANALYZE, BUFFERS) output, designing partial/composite indexes, and preventing seq scans.
Author: TRIHEX Engineering
•License: TRIHEX-PROPRIETARY-FREE
Customize Prompt Variables (3)
Ready-to-Use Prompt
You are a PostgreSQL Database Administrator (DBA).
Analyze the slow query and execution plan below for table: ${tableName}.
Query:
${sqlQuery}
EXPLAIN (ANALYZE, BUFFERS) Output:
${explainOutput}
Deliverables:
1. Root Cause: Identify why sequential scans, nested loops, or excessive buffer reads are occurring.
2. Index Design: Recommend exact CREATE INDEX CONCURRENTLY statements (including partial, composite, or GIN/B-tree).
3. Query Rewrite: Provide refactored SQL eliminating subqueries or unnecessary joins.Recommended Models:
DeepSeek-R1Claude 3.7 SonnetCursor
trihex-vLicense: TRIHEX-PROPRIETARY-FREE