postgresql-table-design
Design a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced features
Security Assessment
About postgresql-table-design
The PostgreSQL Table Design skill provides comprehensive guidance for creating a schema specifically tailored to PostgreSQL databases. It addresses common challenges faced by developers and database administrators when designing efficient and maintainable database structures. By adhering to best practices in normalization, data types, indexing, and constraints, users can significantly reduce data redundancy, enhance performance, and ensure data integrity within their applications.
This skill covers essential features such as defining primary keys, implementing normalization up to the third normal form (3NF), and selecting appropriate data types for various use cases, including timestamps, money, and strings. It also highlights the importance of creating indexes for frequently queried access paths and understanding PostgreSQL-specific behaviors, such as identifier handling and unique constraints. With these capabilities, users can design robust and efficient database schemas that meet their application's requirements.
Target users include developers, database architects, and data engineers who work with PostgreSQL and need to create or maintain database schemas. Use cases range from designing new applications to optimizing existing databases for performance and scalability. By leveraging this skill, users can improve their database design practices and ensure their applications are built on a solid foundation.
FAQ
What are the best practices for defining primary keys in PostgreSQL?
Define a PRIMARY KEY for reference tables and prefer using BIGINT GENERATED ALWAYS AS IDENTITY.
Does PostgreSQL automatically index foreign key columns?
No, PostgreSQL does not auto-index foreign key columns; you need to add them manually.
What data types should I use for monetary values?
Use NUMERIC(p,s) for money to avoid issues with floating-point arithmetic.
Can I use UUIDs as primary keys?
Yes, use UUIDs for global uniqueness or when merging databases, but prefer BIGINT for most cases.
What is the recommended storage strategy for large strings in PostgreSQL?
Use TEXT for large strings and let PostgreSQL handle storage with TOAST, typically with the EXTENDED compression strategy.
Install postgresql-table-design
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
wshobson/agents