sql optimization patterns

Design Community

Skill notes

When to Use This Skill

Debugging slow-running queries Designing performant database schemas Optimizing application response times Reducing database load and costs Improving scalability for growing datasets

1. Query Execution Plans (EXPLAIN)

Understanding EXPLAIN output is fundamental to optimization. PostgreSQL EXPLAIN: Key Metrics to Watch: Seq Scan: Full table scan (usually slow for large tables) Index Scan: Using index (good)

2. Index Strategies

Indexes are the most powerful optimization tool. Index Types: B-Tree: Default, good for equality and range queries Hash: Only for equality (=) comparisons GIN: Full-text search, array queries, JSONB

3. Query Optimization Patterns

Avoid SELECT *: Use WHERE Clause Efficiently: Optimize JOINs:

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

Fluxly profile Runtime and permissions are inferred by Fluxly static checks, not author declarations or runtime test results.
Domain
Design
Author-declared agents
No explicit declaration found; this is not inferred or tested compatibility
Static check
88 / 100 · heuristic scan, not runtime safety proof
Runtime evidence
Not run; no isolated runtime test evidence is currently recorded
Author / version / license
@wshobson · no license declared
Token usage
Lean
Setup complexity
Guided setup
External API key
Not required
Operating systems
Unspecified (assume cross-platform)
Runtime requirements
No explicit requirements detected
Detected file/system behavior
  • Read-only
  • Write / modify
  • Shell exec
Network behavior
External requests
Install commands
None (reference only)

Heads up: Tool permissions are not declared; actual access depends on the runtime.

Output preview sql-optimization-patterns.preview
# Detailed patterns and worked examples

Detailed pattern documentation lives in `references/details.md`. Read that file when the navigation tier above is insufficient.

Discussion

Powered by GitHub Discussions. Sign in with GitHub to comment, react, or subscribe.