B+树索引可以使order by更快

select ... order by  a

a上有索引时执行上面的语句,比a上没有索引时要快。因为B-树索引中各结点已经排好了序,数据库只需要沿着树中的叶子结点链路朝左或朝右走即可。

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.