What problem does it solve?
This Skill provides comprehensive guidance on designing efficient, robust, and maintainable PostgreSQL database schemas, addressing common pitfalls and leveraging advanced features.
Core Features & Use Cases
- Best Practices: Covers essential rules for primary keys, normalization, nullability, and indexing.
- PostgreSQL Specifics: Details unique behaviors and features like identifier casing, unique constraints with NULLs, and MVCC.
- Data Type Selection: Recommends optimal data types for various needs (IDs, money, text, time, JSONB, etc.) and warns against problematic ones.
- Indexing Strategies: Explains different index types (B-tree, GIN, GiST, BRIN) and their use cases.
- Advanced Features: Guides on partitioning, row-level security, generated columns, and extensions.
- Use Case: A developer needs to design a new PostgreSQL table for user profiles, ensuring data integrity, efficient querying, and proper storage of user preferences in JSONB format.
Quick Start
Design a PostgreSQL table for users with an auto-incrementing BIGINT primary key, a NOT NULL email field with a case-insensitive unique constraint, a NOT NULL name field, and a timestamp for creation.