postgres-best-practices
Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.
- License 许可
- MIT
- 最近更新
- 2026-04-19
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- postgres-best-practices
- risk
- safe
- source
- community
- date_added
- 2026-02-27
- description
- Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.
02 资源文件 36
- 参考文档AGENTS.md43.9 KB
- 参考文档metadata.json818 B
- 参考文档README.md3.1 KB
- 参考文档resources/_contributing.md4.0 KB
- 参考文档resources/_sections.md1.6 KB
- 参考文档resources/_template.md1.0 KB
- 参考文档resources/advanced-full-text-search.md1.4 KB
- 参考文档resources/advanced-jsonb-indexing.md1.4 KB
- 参考文档resources/conn-idle-timeout.md1.3 KB
- 参考文档resources/conn-limits.md1.3 KB
- 参考文档resources/conn-pooling.md1.3 KB
- 参考文档resources/conn-prepared-statements.md1.5 KB
- 参考文档resources/data-batch-inserts.md1.3 KB
- 参考文档resources/data-n-plus-one.md1.3 KB
- 参考文档resources/data-pagination.md1.3 KB
- 参考文档resources/data-upsert.md1.4 KB
- 参考文档resources/lock-advisory.md1.5 KB
- 参考文档resources/lock-deadlock-prevention.md1.8 KB
- 参考文档resources/lock-short-transactions.md1.3 KB
- 参考文档resources/lock-skip-locked.md1.3 KB
- 参考文档resources/monitor-explain-analyze.md1.4 KB
- 参考文档resources/monitor-pg-stat-statements.md1.4 KB
- 参考文档resources/monitor-vacuum-analyze.md1.5 KB
- 参考文档resources/query-composite-indexes.md1.4 KB
- 参考文档resources/query-covering-indexes.md1.3 KB
- 参考文档resources/query-index-types.md1.4 KB
- 参考文档resources/query-missing-indexes.md1.2 KB
- 参考文档resources/query-partial-indexes.md1.3 KB
- 参考文档resources/schema-data-types.md1.4 KB
- 参考文档resources/schema-foreign-key-indexes.md1.6 KB
- 参考文档resources/schema-lowercase-identifiers.md1.7 KB
- 参考文档resources/schema-partitioning.md1.5 KB
- 参考文档resources/schema-primary-keys.md1.8 KB
- 参考文档resources/security-privileges.md1.5 KB
- 参考文档resources/security-rls-basics.md1.3 KB
- 参考文档resources/security-rls-performance.md1.5 KB
03 SKILL.md 正文
Supabase Postgres Best Practices
Comprehensive performance optimization guide for Postgres, maintained by Supabase. Contains rules across 8 categories, prioritized by impact to guide automated query optimization and schema design.
When to Use
Reference these guidelines when:
- Writing SQL queries or designing schemas
- Implementing indexes or query optimization
- Reviewing database performance issues
- Configuring connection pooling or scaling
- Optimizing for Postgres-specific features
- Working with Row-Level Security (RLS)
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Query Performance | CRITICAL | query- |
| 2 | Connection Management | CRITICAL | conn- |
| 3 | Security & RLS | CRITICAL | security- |
| 4 | Schema Design | HIGH | schema- |
| 5 | Concurrency & Locking | MEDIUM-HIGH | lock- |
| 6 | Data Access Patterns | MEDIUM | data- |
| 7 | Monitoring & Diagnostics | LOW-MEDIUM | monitor- |
| 8 | Advanced Features | LOW | advanced- |
How to Use
Read individual rule files for detailed explanations and SQL examples:
[query-missing-indexes](file:///[workspace-root]/.agents/skills/postgres-best-practices/resources/query-missing-indexes.md)
[schema-partial-indexes](file:///[workspace-root]/.agents/skills/postgres-best-practices/resources/schema-partial-indexes.md)
[_sections](file:///[workspace-root]/.agents/skills/postgres-best-practices/resources/_sections.md)
Each rule file contains:
- Brief explanation of why it matters
- Incorrect SQL example with explanation
- Correct SQL example with explanation
- Optional EXPLAIN output or metrics
- Additional context and references
- Supabase-specific notes (when applicable)
Full Compiled Document
For the complete guide with all rules expanded: AGENTS.md
When to Use
This skill is applicable to execute the workflow or actions described in the overview.
04 同仓库更多 Skills
wcag-audit-patterns
Comprehensive guide to auditing web content against WCAG 2.2 guidelines with actionable remediation strategies.
unit-testing-test-generate
Generate comprehensive, maintainable unit tests across languages with strong coverage and edge case focus.
testing-qa
Comprehensive testing and QA workflow covering unit testing, integration testing, E2E testing, browser automation, and quality assurance.
test-fixing
Systematically identify and fix all failing tests using smart grouping strategies. Use when explicitly asks to fix tests ("fix these tests", "make tests pass"), reports test failures ("tests are failing", "test suite is broken"), or completes implementation and wants tests passing.
test-driven-development
Use when implementing any feature or bugfix, before writing implementation code
terraform-infrastructure
Terraform infrastructure as code workflow for provisioning cloud resources, creating reusable modules, and managing infrastructure at scale.