SQL中的表扫描和索引扫描

前端之家收集整理的这篇文章主要介绍了SQL中的表扫描和索引扫描前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
sql中的表扫描和索引扫描之间的区别是什么?具体使用它在哪里?

解决方法

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

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

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

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

@H_404_6@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.

@H_404_6@> Oracle:The Query Optimizer

@H_404_6@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.

@H_404_6@> MysqLHow to Avoid Table Scans

猜你在找的MsSQL相关文章