【发布时间】:2014-02-03 22:55:36
【问题描述】:
select s.name,c.name,r.edition,r.grade
from students s, courses c, registrations r
where s.student_id=r.student_id
and r.course_id=c.course_id
and r.grade > 10
order by 1,2,3;
在“等级”列中创建和索引会提高这个查询的性能吗?
【问题讨论】:
-
我可能会回答自己,但如果我们在“等级”中使用索引(我想象一个简单的二叉树),我们不需要扫描所有表来获取大于的值,因为例如,10. 使用索引,我们可以评估很多行,因为数据是“排序的”并且很容易获得特定值。对吗?
标签: sql performance indexing database