-
-
Notifications
You must be signed in to change notification settings - Fork 34
feat: Add initial PostgreSQL best practices rules #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
gregnr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. Just one small comment. Also doesn't have to be in this PR, but I think we should also do this before launch.
skills/postgresql-best-practices/rules/advanced-cte-optimization.md
Outdated
Show resolved
Hide resolved
bf08e57 to
449d047
Compare
543c4d9 to
8903e65
Compare
Agree and thanks for the suggestion. It's now on main |
Rules organized in 8 categories: - Query Performance (5): indexes, partial indexes, composite, covering, types - Connection Management (4): pooling, limits, idle timeout, prepared statements - Schema Design (4): data types, primary keys, foreign key indexes, partitioning - Concurrency & Locking (4): short transactions, SKIP LOCKED, advisory, deadlocks - Security (3): RLS basics, RLS performance, privileges - Data Access Patterns (4): N+1 queries, pagination, upsert, batch inserts - Monitoring (3): EXPLAIN ANALYZE, pg_stat_statements, VACUUM/ANALYZE - Advanced Features (3): JSONB indexing, full-text search, CTE materialization Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: samrose <samuel.rose@gmail.com>
…n.md Co-authored-by: samrose <samuel.rose@gmail.com>
76f8e31 to
0261df6
Compare
gregnr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's fix this before merging
|
Merging this as we reached a consensus about the initial postgres rules. Thanks everyone for the collaboration! |
PostgreSQL Best Practices Rules
Summary
This repository contains 30 PostgreSQL best practices rules organized into 8 categories by priority and impact.
Rules Included
Query Performance (5 rules) - CRITICAL/HIGH
query-missing-indexes.mdquery-partial-indexes.mdquery-composite-indexes.mdquery-covering-indexes.mdquery-index-types.mdConnection Management (4 rules) - CRITICAL/HIGH
conn-pooling.mdconn-limits.mdconn-idle-timeout.mdconn-prepared-statements.mdSchema Design (5 rules) - HIGH/MEDIUM-HIGH/MEDIUM
schema-data-types.mdschema-primary-keys.mdschema-foreign-key-indexes.mdschema-partitioning.mdschema-lowercase-identifiers.mdConcurrency & Locking (4 rules) - MEDIUM-HIGH
lock-short-transactions.mdlock-skip-locked.mdlock-advisory.mdlock-deadlock-prevention.mdSecurity & RLS (3 rules) - MEDIUM-HIGH/HIGH
security-rls-basics.mdsecurity-rls-performance.mdsecurity-privileges.mdData Access Patterns (4 rules) - MEDIUM/MEDIUM-HIGH
data-n-plus-one.mddata-pagination.mddata-upsert.mddata-batch-inserts.mdMonitoring & Diagnostics (3 rules) - MEDIUM/LOW-MEDIUM
monitor-explain-analyze.mdmonitor-pg-stat-statements.mdmonitor-vacuum-analyze.mdAdvanced Features (2 rules) - MEDIUM
advanced-jsonb-indexing.mdadvanced-full-text-search.mdDesign Decisions
Concise Format: Each rule is 25-60 lines, following the established
pattern:
Quantified Impact: Every rule includes specific metrics (e.g., "10-100x
faster", "3x throughput").
Error-First Structure: Shows the anti-pattern first, then the correct
approach.
Validation
cd packages/postgresql-best-practices-build npm run validate npm run build