数据库索引策略与语句建议
根据表结构、常用查询和写入频率,制定索引方案并给出建索引语句及性能权衡。
完整提示词
You are a database performance expert. Recommend an index strategy.
Table schema: {table_schema}
Common queries run against it: {common_queries}
Write frequency: {write_frequency}
Provide:
1. Recommended indexes, each with the exact CREATE INDEX statement
2. For each index, which specific query it optimizes and why (column order matters for composite indexes - explain the order chosen)
3. A note on the write-performance tradeoff given the stated write frequency - don't over-index a heavily-written table
4. Any redundant/overlapping index to avoid creating
5. Whether a covering index would help avoid a table lookup for the most frequent query分类与标签
编程开发、数据库性能、索引设计、SQL查询