postgresql-database-engineering
БесплатноБез исполняемых скриптовНе проверенComprehensive PostgreSQL database engineering skill covering indexing strategies, query optimization, performance tuning, partitioning, replication, backup…
от aAAaqwq★ 123 звезды на GitHubОб этом скилле
PostgreSQL Database Engineering
A comprehensive skill for professional PostgreSQL database engineering, covering everything from query optimization and indexing strategies to high availability, replication, and production database management. This skill enables you to design, optimize, and maintain high-performance PostgreSQL databases at scale.
When to Use This Skill
Use this skill when:
- Designing database schemas for high-performance applications
- Optimizing slow queries and improving database performance
- Implementing indexing strategies for complex query patterns
- Setting up partitioning for large tables (100M+ rows)
- Configuring streaming replication and high availability
- Tuning PostgreSQL configuration for production workloads
- Implementing backup and recovery procedures
- Debugging performance issues and query bottlenecks
- Setting up connection pooling with pgBouncer or PgPool
- Monitoring database health and performance metrics
- Planning database migrations and schema changes
- Implementing database security and access controls
- Scaling PostgreSQL databases horizontally or vertically
- Managing VACUUM operations and database maintenance
- Setting up logical replication for data distribution
Core Concepts
PostgreSQL Architecture
PostgreSQL uses a process-based architecture with several key components:
- Postmaster Process: Main server process that manages connections
- Backend Processes: One per client connection, handles queries
- Shared Memory: Shared buffers, WAL buffers, lock tables
- Background Workers: Autovacuum, checkpointer, WAL writer, statistics collector
- Write-Ahead Log (WAL): Transaction log for durability and replication
- Storage Layer: TOAST for large values, FSM for free space, VM for visibility
MVCC (Multi-Version Concurrency Control)
PostgreSQL's foundational concurrency mechanism:
- Snapshots: Each transaction sees a consistent snapshot of data
- Tuple Versions: Multiple row versions coexist for concurrent access
- Transaction IDs: xmin (creating transaction), xmax (deleting transaction)
- Visibility Rules: Determines which row versions are visible to transactions
- VACUUM: Reclaims space from dead tuples and prevents transaction wraparound
- FREEZE: Marks old rows as visible to all transactions
Key Implications:
- No read locks - readers never block writers
- Writers never block readers
- Updates create new row versions
- Regular VACUUM is essential
- Dead tuples accumulate until vacuumed
Transaction Isolation Levels
PostgreSQL supports four isolation levels:
- Read Uncommitted: Treated as Read Committed in PostgreSQL
- Read Committed (default): Sees committed data at statement start
- Repeatable Read: Sees snapshot from transaction start
- Serializable: True serializable isolation with SSI
Choosing Isolation:
- Read Committed: Most applications, best performance
- Repeatable Read: Reports, analytics needing consistency
- Serializable: Financial transactions, critical consistency needs
Index Types
PostgreSQL offers multiple index types for different use cases:
1. B-Tree (Default)
- Use for: Equality, range queries, sorting
- Supports: <, <=, =, >=, >, BETWEEN, IN, IS NULL
- Best for: Most general-purpose indexing
- Example: Primary keys, foreign keys, timestamps
2. Hash
- Use for: Equality comparisons only
- Supports: = operator
- Best for: Large tables with equality lookups
- Limitation: Not WAL-logged before PG 10, no range queries
3. GiST (Generalized Search Tree)
- Use for: Geometric data, full-text search, custom types
- Supports: Overlaps, contains, nearest neighbor
- Best for: Spatial data, ranges, full-text search
- Example: PostGIS geometries, tsvector, ranges
4. GIN (Generalized Inverted Index)
- Use for: Multi-valued columns (arrays, JSONB, full-text)
- Supports: Contains, exists operators
- Best for: JSONB queries, array operations, full-text search
- Tradeoff: Slower updates, faster queries
5. BRIN (Block Range Index)
- Use for: Very large tables with natural ordering
- Supports: Range queries on sorted data
- Best for: Time-series data, append-only tables
- Advantage: Tiny index size, scales to billions of rows
6. SP-GiST (Space-Partitioned GiST)
- Use for: Non-balanced data structures
- Supports: Points, ranges, IP addresses
- Best for: Quadtrees, k-d trees, radix trees
Query Planning and Optimization
PostgreSQL's query planner determines execution strategies:
Planner Components:
- Statistics: Table and column statistics for cardinality estimation
- Cost Model: CPU, I/O, and memory cost estimation
- Plan Types: Sequential scan, index scan, bitmap scan, joins
- Join Methods: Nested loop, hash join, merge join
- Optimization: Query rewriting, predicate pushdown, join reordering
**
Установить postgresql-database-engineering в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл postgresql-database-engineering?
Comprehensive PostgreSQL database engineering skill covering indexing strategies, query optimization, performance tuning, partitioning, replication, backup and recovery, high availability, and production database management. Master advanced PostgreSQL features including MVCC, VACUUM operations, connection pooling, monitoring, and scalability patterns.
Как установить скилл postgresql-database-engineering?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл postgresql-database-engineering запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic