科技行者

行者学院 转型私董会 科技行者专题报道 网红大战科技行者

知识库

知识库 安全导航

至顶网软件频道mysql降序索引和减轻索引扫描1

mysql降序索引和减轻索引扫描1

  • 扫一扫
    分享文章到微信

  • 扫一扫
    关注官方公众号
    至顶头条

mysql降序索引和减轻索引扫描

作者:ddvip 来源:ddvip 2009年12月23日

关键字: Schema PHP MySQL

  • 评论
  • 分享微博
  • 分享邮件

mysql降序索引和减轻索引扫描1

Descending indexing and loose index scan

  降序索引和减轻索引扫描

  Comments to my previous posts, especially this one by Gokhan inspired me to write a bit about descending indexes and about loose index scan, or what Gokhan calls “better range” support. None of these are actially related to Innodb tables in general - these are features MySQL should get for all storage engines at some point.

  在我以前文章的评论中,尤其是 Gokhan 在这个中提到的,激发了我想写点关于降序索引和减轻索引扫描的东西,或者是 Gokhan 所谓的“改善的范围”支持。通常这些特性跟 Innodb 表都没有内在联系,它们将来在某些时候都能支持各种存储引擎。

  Descending indexes - This is something MySQL does not have at this point, but it was not where for so long at large extent because it is less problem than many people think. First - if index is ascending it does not mean it can’t be scanned in reverse order and it will well be. This is how MySQL will optimize indexed ORDER BY col DESC queries for example. Reverse scan could be as fast as forward scan - this is however where storage engines and operating systems come in play. For example certain operation systems might not do backward read-ahead which may slow it down a bit. Or some storage engines, such as MyISAM (for packed indexes) may have reverse scan being much slower than forward scan.

  降序索引 -- 现在 MySQL 还不支持这个功能,不过这比很多人想的那样,问题少多了。首先,如果索引是顺序的并不意味着它不能倒序扫描,实际上它表现得挺好的。这就是为什么 MySQL 能优化例如 ORDER BY col DESC 查询的索引。倒序扫描能和正序扫描一样快,不过这些是由存储引擎和操作系统来处理的。例如有些操作系统无法倒序读,这对速度有所降低。或者某些存储引擎,如 MyISAM (它压缩了索引) 倒序扫描时比正序扫描来的慢。

    • 评论
    • 分享微博
    • 分享邮件
    邮件订阅

    如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。

    重磅专题
    往期文章
    最新文章