postgresql-table-design

Designs PostgreSQL schemas with identity keys, normalization, constraints, and indexing.

Updated Apr 5, 2026
One-click install
npx skills add https://github.com/pohlai88/afenda-vite-react --skill postgresql-table-design-pohlai88
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgresql-table-design
Source: https://github.com/pohlai88/afenda-vite-react/tree/main/.agents/skills/postgresql-table-design
Command: npx skills add https://github.com/pohlai88/afenda-vite-react --skill postgresql-table-design-pohlai88

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Designing PostgreSQL schemas that are robust, maintainable, and high-performing by applying best-practices for keys, data types, indexing, constraints, and performance patterns.

Core Features & Use Cases

  • Guidance on primary keys, normalization to 3NF, NOT NULL constraints, and sensible defaults to ensure data integrity.
  • Indexing strategies for foreign keys, frequent filters, and join keys; data-type recommendations (TIMESTAMPTZ, NUMERIC, TEXT, UUID) and advanced features (JSONB, range types, table partitioning).
  • Real-world patterns for transactional workloads, reference data models, and event/log tables with scalable design and maintainability.

Quick Start

Define a new PostgreSQL table with a BIGINT identity primary key, TIMESTAMPTZ timestamps, 3NF normalization, and explicit FK indexes.

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 a PostgreSQL schema for high-volume OLTP transactional tables?

Design PostgreSQL schemas for OLTP systems by applying 3NF normalization, using BIGINT GENERATED ALWAYS AS IDENTITY for primary keys, and adding explicit foreign key indexes to maintain data integrity and drive performance.

What are the best practices for indexing foreign keys in PostgreSQL?

Indexing foreign keys in PostgreSQL requires creating explicit FK indexes for join keys and frequent filters to optimize query performance and prevent locking bottlenecks during updates.

When should I use JSONB versus traditional normalization in PostgreSQL table design?

Use JSONB in PostgreSQL for flexible, semi-structured attributes while maintaining 3NF normalization for core relational data, ensuring maintainable schemas without sacrificing query efficiency.

Does PostgreSQL schema design require TIMESTAMPTZ for event log tables?

PostgreSQL event log tables require TIMESTAMPTZ for timestamps to ensure accurate timezone-aware records, combined with thoughtful partitioning strategies to manage scalable log data.

What is the best way to structure primary keys and constraints for PostgreSQL reference data?

Structure PostgreSQL reference data tables using BIGINT identity primary keys, NOT NULL constraints, and sensible defaults to enforce strict data integrity and maintain referential consistency.

How does MVCC impact PostgreSQL table design and partitioning strategies?

MVCC impacts PostgreSQL table design by requiring careful clustering and table partitioning strategies to manage bloat and optimize transactional throughput in high-concurrency environments.