home / skills / partme-ai / full-stack-skills / postgresql
This skill helps you master PostgreSQL by guiding complex queries, performance tuning, JSON support, and full-text search for robust database work.
npx playbooks add skill partme-ai/full-stack-skills --skill postgresqlReview the files below or copy the command above to add this skill to your agents.
---
name: postgresql
description: Provides comprehensive guidance for PostgreSQL database including SQL syntax, advanced features, JSON support, full-text search, and performance tuning. Use when the user asks about PostgreSQL, needs to work with PostgreSQL features, write complex queries, or optimize PostgreSQL databases.
license: Complete terms in LICENSE.txt
---
## When to use this skill
Use this skill whenever the user wants to:
- [待完善:根据具体工具添加使用场景]
## How to use this skill
[待完善:根据具体工具添加使用指南]
## Best Practices
[待完善:根据具体工具添加最佳实践]
## Keywords
[待完善:根据具体工具添加关键词]
This skill provides practical, hands-on guidance for working with PostgreSQL databases. It covers SQL syntax, advanced features like window functions and CTEs, JSON support, full-text search, and performance tuning. Use it to write complex queries, design schemas, and diagnose performance problems. The guidance focuses on actionable examples and best practices for production systems.
The skill inspects user questions and database scenarios to produce targeted SQL examples, configuration recommendations, and troubleshooting steps. It explains query plans, index strategies, and storage settings, and generates sample SQL or psql commands you can run directly. Where relevant, it outlines risks and trade-offs for options such as partitioning, replication, and vacuum settings.
When should I use JSONB instead of normalized tables?
Use JSONB for flexible, infrequently queried attributes or when schema changes are frequent. Use normalized tables when you need strong relational integrity, frequent indexed lookups, or complex joins.
How do I find the cause of a slow query?
Run EXPLAIN (ANALYZE, BUFFERS) to see actual execution times and I/O. Check for missing indexes, sequential scans on large tables, and excessive sorts or hash spills; then add indexes or rewrite the query.