详细分析 ▾
运行时依赖
版本
db-design 1.0.0 – Initial release - Introduces a structured six-stage workflow for relational database (OLTP) schema design and review. - Covers domain and access patterns, entity & relationship modeling, key & constraint strategies, normalization vs denormalization, indexing, and operational concerns. - Includes triggers for when to use the workflow, expected exit conditions, and a final review checklist. - Provides specific multi-tenant considerations and high-level tips for schema evolution. - Designed for both greenfield projects and performance/integrity reviews.
安装命令 点击复制
技能文档
Good OLTP design balances integrity, write paths, query patterns, and evolution—not “third normal form everywhere.”
当...时 到 Offer Workflow
Trigger conditions:
- Greenfield 服务 schema 或 major 新的 domain
- Performance 或 integrity issues 从 ad-hoc tables
- Multi-tenant isolation questions
Initial offer:
Use six stages: (1) domain & access patterns, (2) entities & relationships, (3) keys & constraints, (4) normalization trade-offs, (5) indexing & performance, (6) operations & evolution). Confirm RDBMS and scale expectations.
Stage 1: Domain & Access Patterns
Goal: 列表 critical queries 和 writes: QPS, joins, filters, hot rows.
Exit 条件: Top access paths ranked 由 business importance.
Stage 2: Entities & Relationships
Goal: ER 模型; cardinality; 可选 vs 必填 relationships.
Practices
- 清除 表 names; avoid opaque “data” blobs unless documented
Stage 3: Keys & Constraints
Goal: Primary keys (surrogate vs natural); foreign keys 带有 explicit 在...上 删除 policy; unique constraints 对于 business rules.
Multi-tenant
tenant_id在...上 rows 需要 isolation; composite keys 或 indexes 作为 appropriate
Stage 4: Normalization Trade-offs
Goal: Normalize 到 归约 更新 anomalies; denormalize 读取 hotspots 带有 documented trade-offs.
Stage 5: Indexing & Performance
Goal: Indexes serve real queries; watch 写入 amplification 和 索引 bloat.
Stage 6: Operations & Evolution
Goal: Migration strategy (expand/contract); 备份/恢复; PII columns flagged.
Final Review Checklist
- [ ] Access patterns drive schema
- [ ] Keys, FKs, 和 constraints explicit
- [ ] Multi-tenant isolation 如果 applicable
- [ ] Normalization decisions justified
- [ ] 索引 plan aligned 带有 queries
- [ ] Migration 和 ops considerations noted
Tips 对于 Effective Guidance
- 空 semantics 和 defaults matter 对于 bugs 和 migrations.
- Pair 带有 db-迁移 对于 在线 schema changes.
Handling Deviations
- Document stores: embed vs reference 带有 consistency story.
免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制