postgres-best-practices

โดย neondatabase

แนวทางปฏิบัติและข้อแนะนำที่ดีที่สุดสำหรับการทำงานกับ Postgres ครอบคลุมการออกแบบ schema, กลยุทธ์การสร้าง index, การปรับแต่ง query, การทำ migration, และข้อผิดพลาดที่พบบ่อย ใช้…

npx skills add https://github.com/neondatabase/postgres-skills --skill postgres-best-practices

Postgres Best Practices

Guidelines and best practices for working with Postgres, covering schema design, indexing, query optimization, and common pitfalls.

Supported Versions

This skill covers PostgreSQL 14 through 18. Version-specific features are tagged (e.g., [PG15+], [PG18+]); environment-dependent examples identify required privileges, extensions, or multi-node setup.

PostgreSQL provides 5 years of support per major version. Always run the latest minor release.

VersionInitial ReleaseEnd of Life
18September 2025November 2030
17September 2024November 2029
16September 2023November 2028
15October 2022November 2027
14September 2021November 2026

Source: postgresql.org/support/versioning

References

AreaResourceWhen to Use
Schema Designreferences/schema-design.mdDesigning tables, choosing data types, normalizing, partitioning
Indexingreferences/indexing.mdChoosing index types, composite indexes, partial/covering indexes
Query Optimizationreferences/query-optimization.mdReading EXPLAIN ANALYZE, fixing bottlenecks, planner tuning
Query Patternsreferences/query-patterns.mdCTEs, window functions, lateral joins, UPSERT, JSONB, anti-patterns
Performance Diagnosticsreferences/performance-diagnostics.mdpg_stat views, lock analysis, VACUUM, connection management
Logical Replicationreferences/logical-replication.mdPub/sub replication, live migrations, CDC
Hot Standbyreferences/hot-standby.mdStreaming replication, read replicas, failover
Transaction Isolationreferences/transaction-isolation.mdIsolation levels, lost updates, serialization failures, retry logic
Backup & Restorereferences/backup-restore.mdpg_dump/pg_restore, pg_basebackup, PITR, recovery
Security & Rolesreferences/security-roles.mdPrivileges, RLS, pg_hba.conf, authentication, SSL
Bulk Data Loadingreferences/bulk-loading.mdCOPY patterns, ETL staging, optimizing large loads, batch ops
Connection Poolingreferences/connection-pooling.mdPgBouncer config, pool modes, prepared statements, sizing
Major Version Upgradesreferences/major-version-upgrades.mdpg_upgrade, logical replication migration, pre/post checklists

Skills เพิ่มเติมจาก neondatabase

claimable-postgres
neondatabase
ฐานข้อมูล Postgres แบบทันทีสำหรับการพัฒนาในเครื่อง การสาธิต การสร้างต้นแบบ และสภาพแวดล้อมการทดสอบ ไม่ต้องมีบัญชี ฐานข้อมูลจะหมดอายุหลังจาก 72 ชั่วโมง เว้นแต่จะถูกอ้างสิทธิ์ไปยังบัญชี Neon
neon
neondatabase
ภาพรวมของแพลตฟอร์ม Neon สำหรับแอปและเอเจนต์ ครอบคลุม Postgres, Auth, Data API และบริการใหม่: Object Storage, Compute Functions และ AI Gateway ใช้เมื่อมีการกล่าวถึง "Neon" เพื่อดูภาพรวมการทำงานกับ Neon และวิธีการเริ่มต้น มิฉะนั้น ความสามารถเฉพาะตัวจะเป็นตัวกระตุ้น: "object storage" หรือ "S3-compatible storage", "serverless functions", "background jobs" หรือ "run code near my database", "AI gateway", "LLM proxy", "model routing" หรือ "call an LLM" →...
apidatabasedevelopment
plugin-manager
neondatabase
จัดการโครงสร้างปลั๊กอินและการกำหนดค่าสำหรับพื้นที่เก็บข้อมูลนี้ทั้งใน Cursor และ Claude Code ใช้เมื่อสร้าง อัปเดต หรือตรวจสอบโฟลเดอร์ปลั๊กอิน…
skill-creator
neondatabase
คู่มือสำหรับการสร้างสกิลที่มีประสิทธิภาพ สกิลนี้ควรใช้เมื่อผู้ใช้ต้องการสร้างสกิลใหม่ (หรืออัปเดตสกิลที่มีอยู่) ที่ขยายความสามารถของ Claude...
using-neon
neondatabase
คู่มือและแนวทางปฏิบัติที่ดีที่สุดสำหรับการทำงานกับ Neon Serverless Postgres ครอบคลุมการเริ่มต้นใช้งาน การพัฒนาท้องถิ่นกับ Neon การเลือกวิธีการเชื่อมต่อ Neon…
neon-js-react
neondatabase
ตั้งค่า Neon SDK แบบสมบูรณ์พร้อมการตรวจสอบสิทธิ์และการค้นหาฐานข้อมูลในแอป React (Vite, CRA) สร้างไคลเอนต์แบบมีชนิด สร้างชนิดข้อมูลฐานข้อมูล และกำหนดค่า…
neon-postgres-egress-optimizer
neondatabase
แนะนำผู้ใช้ในการวินิจฉัยและแก้ไขรูปแบบการค้นหาข้อมูลฝั่งแอปพลิเคชันที่ทำให้เกิดการถ่ายโอนข้อมูลมากเกินไป (egress) จากฐานข้อมูล Postgres ของพวกเขา ค่าใช้จ่าย egress ที่สูงส่วนใหญ่มาจากแอปพลิเคชันที่ดึงข้อมูลมากกว่าที่ใช้งานจริง
neon-postgres-branches
neondatabase
ผลลัพธ์ของสกิลนี้ควรเป็นสาขา Neon ที่ถูกสร้างขึ้น (หรือขั้นตอนถัดไปที่ชัดเจนและสามารถดำเนินการได้ หากไม่สามารถดำเนินการสร้างต่อได้) เลือกประเภทสาขาที่ถูกต้อง จากนั้นดำเนินการสร้างสาขาผ่าน MCP หรือ CLI