database-patterns
仓库创建 2025年12月9日最近提交 9 天前SkillHot 收录 20 天前
▸ 精选理由
覆盖常见后端存储权衡,适合设计高性能持久化与缓存方案的工程师参考。
这个 Skill 做什么
为 PostgreSQL+Redis 提供索引、缓存、JSONB 与分层存储等数据建模与一致性策略建议。
做数据建模时,尤其是 PostgreSQL 配合 Redis 的场景,这套建议会给出索引设计、缓存策略、JSONB 使用和冷热数据分层的实战方案。适合在设计查询、优化性能或解决缓存一致性问题的时候参考。核心思想是先按查询设计索引、默认 Cache-Aside、尽量少滥用 JSONB,并把事务性留给 PostgreSQL、实时/缓存交给 Redis。
▸ 展开 SKILL.md 英文原文
Use when designing PostgreSQL + Redis data models, indexes, caching strategies, JSONB usage, tiered storage, or cache consistency contracts.
239
Stars
23
Forks
40
仓库内 Skill
+7
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/majiayu000/spellbook/main/skills/database-patterns/SKILL.md或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/majiayu000/spellbook/main/skills/database-patterns/SKILL.md"SKILL.MD 节选查看完整文件 ↗
# Database Patterns ## Core Principles - **PostgreSQL Primary** — Relational data, transactions, complex queries - **Redis Secondary** — Caching, sessions, real-time data - **Index-First Design** — Design queries before indexes - **JSONB Sparingly** — Structured data prefers columns - **Cache-Aside Default** — Read-through, write-around - **Tiered Storage** — Hot/Warm/Cold data separation - **No backwards compatibility** — Migrate data, don't keep legacy schemas --- ## PostgreSQL ### Data Type Selection | Use Case | Type | Avoid | |----------|------|-------| | Primary Key | `UUID` / `BIGSERIAL` | `INT` (range limits) | | Timestamps | `TIMESTAMPTZ` | `TIMESTAMP` (no timezone) | | Money
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有