Prompt
0 copies · 0 said it worked
Database indexing guidance for a backend engineer's query tuning
A set of rules a backend engineer follows to design, measure, and maintain database indexes based on real query plans and workload data.
People use this for
- database index design for slow queries
- postgres index tuning guidance
- choosing composite index column order
- how to index database for query performance
- which index type for jsonb or arrays
Imported on Nov 29, 2026 from Database Indexing taste . License observed at the source on Nov 29, 2026: CC0.
Are you the author?Claim this profileRequest removal
Prompt
# Database Indexing taste of a backend engineer who indexes for real queries, not guesses - Design indexes from the actual slow query log and `EXPLAIN (ANALYZE, BUFFERS)` output, not from the schema alone. Confidence: 0.95 - Index every foreign key column that is used in joins or cascading deletes. Confidence: 0.90 - Order composite index columns by equality filters first, then range filters, then sort columns. Confidence: 0.90 - Prefer one well-chosen composite index over several single-column indexes the planner has to combine. Confidence: 0.85 - Drop indexes whose leading columns duplicate another index; `(a)` is redundant next to `(a, b)`. Confidence: 0.85 - Use covering indexes (`INCLUDE` columns) for hot read paths so queries can use index-only scans. Confidence: 0.80 - Use partial indexes for skewed data, such as `WHERE deleted_at IS NULL` or `WHERE status = 'pending'`. Confidence: 0.90 - Enforce uniqueness with unique indexes or constraints in the database, never only in application code. Confidence: 0.95 - Create indexes on large live tables with `CREATE INDEX CONCURRENTLY` (or the engine's online equivalent) in a migration of its own. Confidence: 0.95 - Never wrap indexed columns in functions in `WHERE` clauses; add an expression index like `lower(email)` when needed. Confidence: 0.85 - Avoid leading-wildcard `LIKE '%term'` on B-tree indexes; use trigram or full-text indexes for substring search. Confidence: 0.85 - Pick GIN for JSONB containment and arrays, BRIN for huge append-only time-series tables, B-tree for everything else. Confidence: 0.80 - Use keyset pagination on an indexed sort key instead of large `OFFSET` values. Confidence: 0.90 - Keep low-cardinality booleans out of standalone indexes; fold them into a partial or composite index instead. Confidence: 0.80 - Review index usage statistics monthly and remove indexes with zero scans after confirming replicas do not use them. Confidence: 0.75 - Budget write cost: every extra index slows inserts and updates, so write-heavy tables get the fewest indexes. Confidence: 0.85 - Keep table statistics fresh with autovacuum/analyze tuning on big, fast-changing tables. Confidence: 0.80 - Watch for index bloat and rebuild with `REINDEX CONCURRENTLY` when it degrades performance. Confidence: 0.70 - Name indexes predictably, for example `idx_<table>_<columns>` and `uq_<table>_<columns>`. Confidence: 0.75 - Add a query plan check to code review for any new query on a table above a million rows. Confidence: 0.70 - Test index changes on a production-sized copy or branch before shipping them. Confidence: 0.85 - Never add an index just because a column appears in a `WHERE` clause somewhere; measure first. Confidence: 0.80
No result recorded for this import yet. Tried it? File a report so the next person knows how it went.
Tried it
Structured reports from people who ran this prompt. They roll up into the per-model badges above.
No one has filed a report yet. Try the prompt and be the first.
Related prompts
- SQL Index Recommendation Reviewer for slow queries and schemas
Reviews a schema and slow SQL queries, proposes composite indexes in the right column order, flags non-sargable filters, and warns about duplicate, redundant, and low-selectivity indexes, with a stdlib Python helper.
Data & Finance · @f
- Review SQL queries and EXPLAIN plans for performance and correctness problems
Skill-style prompt that makes the model act as a database engineer reviewing SQL and optional EXPLAIN output, flagging anti-patterns like SELECT *, function-wrapped columns, leading-wildcard LIKE, N+1 loops and AND/OR precedence, then returning rewritten queries with reasons and a measurement plan.
Coding · @f
- Master prompt for building a district campaign field operations platform
A long master development prompt asking an AI to build a full-stack government district campaign management, field data collection, verification, and payment platform.
Coding · @maarifkhatri91
- Design multi-layer caching architecture plan and implementation checklist
A role prompt that makes the model act as a caching strategy architect, producing a TODO_caching-architect.md with layered cache design, invalidation strategies, TTL and eviction settings, and validation steps.
Coding · @wkaandemir
- Backend architect role for designing scalable server-side systems
A system-style role prompt that makes the model act as a senior backend architect, producing task-tracked Markdown plans covering APIs, databases, security, performance, and DevOps for server-side systems.
Coding · @wkaandemir
License: CC0v1 · published Nov 29, 2026
Comments
No comments yet. If you tried this prompt, say how it went.