PostgreSQL Best Practices
SkillDatabases & dataGives your agent expert guidance for writing and optimizing Postgres queries, schemas, and settings.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the PostgreSQL Best Practices skill
About this capability
PostgreSQL best practices for database design, query optimization, and performance tuning
What this skill tells your AI
The instructions your AI receives, as published by baekenough/oh-my-customcode in .claude/skills/postgres-best-practices/SKILL.md and read by ahel’s review.
Query Optimization
EXPLAIN ANALYZE (CRITICAL)
- Use
EXPLAIN ANALYZEto understand query plans - Identify slow operations: Seq Scan, Nested Loop
- Check row estimates vs actual rows
- Monitor buffers: shared hit vs read
Indexing (CRITICAL)
- B-tree: default, most use cases
- GIN: JSONB, arrays, full-text search
- GiST: geometry, range types
- BRIN: large sequential tables (time-series)
- Partial indexes: filtered queries
- Covering indexes (INCLUDE): avoid heap fetches
Index Maintenance
- Create indexes concurrently:
CREATE INDEX CONCURRENTLY - Monitor usage:
pg_stat_user_indexes - Remove unused indexes
- Reindex bloated indexes
Table Design
Partitioning (HIGH)
- Range partitioning: time-series data
- List partitioning: categorical data
- Hash partitioning: even distribution
- Declarative partitioning (PG 10+)
Data Types
- Use appropriate types (int vs bigint, varchar vs text)
- JSONB for semi-structured data
- Arrays for multi-value columns
- UUIDs for distributed IDs
Performance Tuning
Vacuum and Autovacuum
- Autovacuum: default enabled
- Monitor bloat:
pg_stat_user_tables - Tune autovacuum thresholds
- Manual VACUUM for large updates
Connection Pooling
- Use pgBouncer or PgPool
- Transaction pooling for short transactions
- Session pooling for long transactions
- Max connections: tune based on workload
Configuration
shared_buffers: 25% of RAMwork_mem: per operation, tune carefullyeffective_cache_size: 50-75% of RAMrandom_page_cost: 1.1 for SSD
References
Signals
- GitHub stars
- 34
- Forks
- 6
- Last commit
- Sep 2026
ahel review
S4info
community integration — published by baekenough, not postgres
Automated review, not a security audit. Ruleset v1.
Advanced
- Catalog kind
- skill
- Gateway key
postgres-best-practices- Source
- github.com/baekenough/oh-my-customcode