技能 编程开发 数据库设计与优化

数据库设计与优化

v20261107
database-design
掌握数据库设计原则,包括架构规划、索引策略和 ORM 选型。学习根据上下文选择合适数据库而非盲目默认。涵盖迁移、性能调优及避免 N+1 查询等常见反模式,提升数据管理效率。
获取技能
351 次下载
概览

Database Design

Learn to THINK, not copy SQL patterns.

🎯 Selective Reading Rule

Read ONLY files relevant to the request! Check the content map, find what you need.

FileDescriptionWhen to Read
database-selection.mdPostgreSQL vs Neon vs Turso vs SQLiteChoosing database
orm-selection.mdDrizzle vs Prisma vs KyselyChoosing ORM
schema-design.mdNormalization, PKs, relationshipsDesigning schema
indexing.mdIndex types, composite indexesPerformance tuning
optimization.mdN+1, EXPLAIN ANALYZEQuery optimization
migrations.mdSafe migrations, serverless DBsSchema changes

⚠️ Core Principle

  • ASK user for database preferences when unclear
  • Choose database/ORM based on CONTEXT
  • Don't default to PostgreSQL for everything

Decision Checklist

Before designing schema:

  • [ ] Asked user about database preference?
  • [ ] Chosen database for THIS context?
  • [ ] Considered deployment environment?
  • [ ] Planned index strategy?
  • [ ] Defined relationship types?

Anti-Patterns

❌ Default to PostgreSQL for simple apps (SQLite may suffice)
❌ Skip indexing
❌ Use SELECT * in production
❌ Store JSON when structured data is better
❌ Ignore N+1 queries

信息
分类 编程开发
名称 database-design
版本 v20261107
大小 6.91KB
更新时间 2026-11-08
语言