加入收藏 | 设为首页 | 会员中心 | 我要投稿 源码门户网 (https://www.92codes.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

SQL中的表扫描和索引扫描

发布时间:2021-04-01 02:15:31 所属栏目:MsSql教程 来源:网络整理
导读:SQL中的表扫描和索引扫描之间的区别是什么?具体使用它在哪里? 解决方法 表扫描意味着遍历所有表行. 索引扫描意味着遍历所有索引项,当项索引满足搜索条件时,通过索引检索表行. Usualy索引扫描比表扫描便宜,因为索引比表更平坦. 关于这个问题,他们有很多书

SQL中的表扫描和索引扫描之间的区别是什么?具体使用它在哪里?

解决方法

表扫描意味着遍历所有表行.

索引扫描意味着遍历所有索引项,当项索引满足搜索条件时,通过索引检索表行.

Usualy索引扫描比表扫描便宜,因为索引比表更平坦.

关于这个问题,他们有很多书目.样品:

>微软:Which is Faster: Index Access or Table Scan?:

Index access is an access method in which SQL Server uses an existing
index to read and write data pages. Because index access significantly
reduces the number of I/O read operations,it often outperforms a
table scan.

> Oracle:The Query Optimizer

In this method,a row is retrieved by traversing the index,using the
indexed column values specified by the statement. An index scan
retrieves data from an index based on the value of one or more columns
in the index. To perform an index scan,Oracle searches the index for
the indexed column values accessed by the statement. If the statement
accesses only columns of the index,then Oracle reads the indexed
column values directly from the index,rather than from the table.

> MySql:How to Avoid Table Scans

(编辑:源码门户网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读