postgresql-table-design

Define PostgreSQL table schemas with normalization, data types, indexing, and constraints.

110|19|Updated Feb 11, 2026
One-click install
npx skills add https://github.com/chendongqi/OPB-Skills --skill postgresql-table-design-chendongqi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgresql-table-design
Source: https://github.com/chendongqi/OPB-Skills/tree/main/skills/rnd-postgresql-table-design
Command: npx skills add https://github.com/chendongqi/OPB-Skills --skill postgresql-table-design-chendongqi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Designing PostgreSQL tables can be error-prone and hard to optimize across evolving requirements. This Skill provides a structured approach to create scalable, maintainable schemas, covering normalization, data types, constraints, indexing, and partitioning.

Core Features & Use Cases

  • Guidance on when to normalize to 3NF, when to denormalize for performance, and how to model reference vs event data.
  • Recommendations for data types, primary keys, foreign keys, constraints, and sensible defaults to ensure data integrity and query efficiency.
  • Advanced patterns for indexing, timestamps, partitioning, and performance considerations for large-scale OLTP and analytics workloads.

Quick Start

Analyze your current PostgreSQL schema and apply these rules to craft a robust, scalable table design.

Frequently Asked Questions about postgresql-table-design

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I design PostgreSQL tables for scalable OLTP workloads?

To design PostgreSQL tables for OLTP workloads, apply normalization, choose precise data types, and enforce constraints. This ensures data integrity and query efficiency for high-volume transactional systems.

When should I denormalize a PostgreSQL schema for performance?

You should denormalize a PostgreSQL schema when query performance demands it, typically for analytics workloads. This Skill provides guidance on when to model reference versus event data and when to trade normalization for speed.

What are the best practices for primary keys and foreign keys in PostgreSQL?

Best practices for primary keys and foreign keys in PostgreSQL involve using robust constraints and sensible defaults. Concrete examples help ensure safe schema evolution and maintain referential integrity across relational models.

How does partitioning work for large PostgreSQL event tables?

Partitioning large PostgreSQL event tables splits data across multiple physical tables based on specific criteria like timestamps. This advanced pattern improves query performance and manageability for large-scale analytics workloads.

What indexing strategies should I use for PostgreSQL schema design?

PostgreSQL schema design indexing strategies target specific query patterns to optimize retrieval without sacrificing write performance. Applying these patterns ensures efficient data access across typical relational models.

Can I safely evolve a PostgreSQL table schema with constraints over time?

You can safely evolve a PostgreSQL table schema by applying concrete examples for primary keys, foreign keys, and partitioning. This structured approach maintains data integrity while adapting to changing requirements.