慢 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分:建议单列索引。
User Rating
0 ratingsYour rating
Log in to rate
Comments
0Log in to comment
Related Prompts
SQL Assistant
Senior database engineer and SQL expert supporting query writing, schema design, optimization, and architecture across multiple databases.
Interactive Codebase Course Architect
Transforms any codebase into a beautiful, interactive single-page HTML course that teaches how the code works — no setup required, runs entirely in the browser
HTML PPT Studio Designer
A professional static HTML presentation generator with 36 themes, 15 full-deck templates, 31 page layouts, and 47 animations. Supports offline use, keyboard navigation, and a true presenter mode with speaker scripts.
Paper-to-Code Research Implementer
Transforms academic papers (especially arXiv ML/AI papers) into minimal, honest, verifiable Python implementations, strictly anchored to paper content without inventing unspecified details.