1---2name: postgres3description: PostgreSQL best practices, query optimization, schema design, security, operations, and performance tuning. Load when working with Postgres databases.4license: MIT5---67# PostgreSQL89## Schema and Data Modeling1011| Topic | Reference | Use for |12| -------------- | ---------------------------------------------------------- | ------------------------------------------------------ |13| Schema Design | [references/schema-design.md](references/schema-design.md) | Tables, primary keys, data types, foreign keys, naming |14| JSONB Patterns | [references/json-patterns.md](references/json-patterns.md) | JSONB operators, querying, indexing, best practices |15| Partitioning | [references/partitioning.md](references/partitioning.md) | Range/list partitioning, pg_partman, data retention |1617## Querying and Optimization1819| Topic | Reference | Use for |20| ---------------------- | ---------------------------------------------------------------------------- | -------------------------------------------------------- |21| Query Patterns | [references/query-patterns.md](references/query-patterns.md) | SQL anti-patterns, JOINs, pagination, N+1 detection |22| Indexing | [references/indexing.md](references/indexing.md) | Index types, composite, partial, covering, GIN, BRIN |23| Index Optimization | [references/index-optimization.md](references/index-optimization.md) | Unused/duplicate index detection, bloat, HOT updates |24| Full-Text Search | [references/full-text-search.md](references/full-text-search.md) | tsvector, tsquery, GIN indexing, ranking, search config |25| Optimization Checklist | [references/optimization-checklist.md](references/optimization-checklist.md) | Pre-optimization audit, cleanup, readiness checks |2627## Internals and Concurrency2829| Topic | Reference | Use for |30| ----------------- | ------------------------------------------------------------------ | ------------------------------------------------------ |31| MVCC and VACUUM | [references/mvcc-vacuum.md](references/mvcc-vacuum.md) | Dead tuples, autovacuum tuning, bloat prevention |32| MVCC Transactions | [references/mvcc-transactions.md](references/mvcc-transactions.md) | Isolation levels, XID wraparound, serialization errors |33| Locking | [references/locking.md](references/locking.md) | Lock types, deadlocks, advisory locks, lock monitoring |3435## Operations and Architecture3637| Topic | Reference | Use for |38| -------------------- | -------------------------------------------------------------------------- | --------------------------------------------------------------- |39| Process Architecture | [references/process-architecture.md](references/process-architecture.md) | Multi-process model, connection management, auxiliary processes |40| Memory Architecture | [references/memory-management-ops.md](references/memory-management-ops.md) | Shared/private memory, OS page cache, OOM prevention |41| WAL and Checkpoints | [references/wal-operations.md](references/wal-operations.md) | WAL internals, checkpoint tuning, durability, crash recovery |42| Storage Layout | [references/storage-layout.md](references/storage-layout.md) | PGDATA structure, TOAST, fillfactor, tablespaces |43| Replication | [references/replication.md](references/replication.md) | Streaming replication, slots, sync commit, failover |44| Backup and Recovery | [references/backup-recovery.md](references/backup-recovery.md) | pg_dump, pg_basebackup, PITR, WAL archiving |4546## Configuration and Tuning4748| Topic | Reference | Use for |49| -------------------- | ------------------------------------------------------------------------ | -------------------------------------------------------- |50| Configuration Tuning | [references/configuration-tuning.md](references/configuration-tuning.md) | Memory, I/O, planner, parallelism, workload profiles |51| Connection Pooling | [references/connection-pooling.md](references/connection-pooling.md) | PgBouncer setup, pool sizing, pooling modes |52| Monitoring | [references/monitoring.md](references/monitoring.md) | pg_stat views, logging, pg_stat_statements, host metrics |5354## Framework Integration5556| Topic | Reference | Use for |57| ------------------ | ------------------------------------------------------------------------ | ---------------------------------------------------------------- |58| Django Integration | [references/django-integration.md](references/django-integration.md) | ORM optimization, connection pooling, zero-downtime migrations, contrib.postgres |5960## Security and Migrations6162| Topic | Reference | Use for |63| ----------------- | ------------------------------------------------------------------ | --------------------------------------------------------- |64| Security | [references/security.md](references/security.md) | Roles, permissions, RLS, pg_hba.conf, SSL/TLS, audit |65| Schema Migrations | [references/schema-migrations.md](references/schema-migrations.md) | Zero-downtime DDL, safe migration patterns, backfills |66| Extensions | [references/extensions.md](references/extensions.md) | pg_stat_statements, pgcrypto, PostGIS, pg_repack, pgAudit |