Easy Prompt
CodingCodeIntermediatepopular

慢 SQL 索引诊断

给出查询和表结构,让模型提出索引与验证计划。

Prompt Content

Copy and paste directly into your model or internal evaluation tool.

表 orders(id, user_id, status, created_at, amount),查询:select * from orders where user_id = ? and status = 'paid' order by created_at desc limit 20。数据量 5000 万。请设计索引、说明字段顺序,并给出如何验证索引是否生效。

Use Cases

后端评测数据库评审

Reference Output

可建联合索引 (user_id, status, created_at desc),用 EXPLAIN/ANALYZE 验证过滤、排序和回表成本。

Scoring Rubric

5分:说明顺序和验证;3分:只给索引;1分:建议单列索引。

Try & save

Fill variables and copy, or save as a personal template.

This template has no variables and is ready to copy.

User Rating

0 ratings
-

Your rating

Log in to rate

Comments

0

Log in to comment

Related Prompts