postgresql
Design a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced features
- License 许可
- MIT
- 最近更新
- 2026-04-19
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- postgresql
- risk
- unknown
- source
- community
- description
- Design a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced features
02 资源文件 5
- 参考文档resources/pg-core-rules-and-gotchas.md1.6 KB
- 参考文档resources/pg-data-types-guide.md1.5 KB
- 参考文档resources/pg-indexing-and-partitioning.md1.6 KB
- 参考文档resources/pg-jsonb-and-extensions.md1.5 KB
- 参考文档resources/pg-performance-and-evolution.md1.5 KB
03 SKILL.md 正文
PostgreSQL Table Design
Overview
Design high-performance, maintainable schemas specifically for PostgreSQL. This skill covers data type selection, indexing strategies, and advanced features like partitioning and RLS.
? Resources
| Resource | Description |
|---|---|
| [Core Rules & Gotchas](file:///c:/workspaces/antigravity-meta/.agents/skills/postgresql/resources/pg-core-rules-and-gotchas.md) | surrogate keys, normalization, and PITR pitfalls. |
| [Data Types Guide](file:///c:/workspaces/antigravity-meta/.agents/skills/postgresql/resources/pg-data-types-guide.md) | Deep-dive into IDs, numeric types, and specialized storage. |
| [Indexing & Partitioning](file:///c:/workspaces/antigravity-meta/.agents/skills/postgresql/resources/pg-indexing-and-partitioning.md) | B-tree, GIN, GiST indexes and range/list partitioning. |
| [Performance Patterns](file:///c:/workspaces/antigravity-meta/.agents/skills/postgresql/resources/pg-performance-and-evolution.md) | Update-heavy vs. Insert-heavy design and safe migrations. |
| [JSONB & Extensions](file:///c:/workspaces/antigravity-meta/.agents/skills/postgresql/resources/pg-jsonb-and-extensions.md) | Managing semi-structured data and using pgvector/PostGIS. |
Core Workflow
1. Data Modeling & Invariants
Choose correct data types (e.g., TIMESTAMPTZ, BIGINT) and enforce invariants with constraints.
2. Indexing Strategy
Implement indexes for actual access paths (PKs, FKs, frequent filters).
See [Indexing & Partitioning](file:///c:/workspaces/antigravity-meta/.agents/skills/postgresql/resources/pg-indexing-and-partitioning.md).
3. Advanced Features
Utilize JSONB for flexible attributes and partitioning for large-scale data.
See [JSONB & Extensions](file:///c:/workspaces/antigravity-meta/.agents/skills/postgresql/resources/pg-jsonb-and-extensions.md).
4. Evolution
Execute safe, transactional DDL changes.
See [Performance Patterns](file:///c:/workspaces/antigravity-meta/.agents/skills/postgresql/resources/pg-performance-and-evolution.md).
Recommended Data Types
- IDs:
BIGINT GENERATED ALWAYS AS IDENTITY - Time:
TIMESTAMPTZ - Currency:
NUMERIC(p, s)
Related Skills
database-architect: High-level data architecture.database-optimizer: SQL tuning.
Summary
Design PostgreSQL schemas that are reliable, performant, and scalable from day one.
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.