Efficiency_indexseek and indexscan improve sql efficiency
Introduction: This article is compiled by the editor of Programming Notes# for you. It mainly introduces the knowledge related to index seek and index scan to improve SQL efficiency. I hope it has certain reference value for you. Index seek and index scan improve sql efficiencyExplain index seek and index scan:The index is a B tree,index seek is to search from Starting from the root node of the B-tree, find the target row level by level. Index scan traverses the entire B tree from left to right. Assume that the only target row is located on the rightmost leaf node of the index tree (assuming it is a non-clustered index, the tree depth is 2, and the leaf node occupies k pages of physical storage). The IO caused by index seek is 4, while the IO caused by index scan is K, the performance difference is huge. About indexes, you can carefully read the online documentation about the physical database architecture section Do not include operations in the query conditionsThese operations include string concatenation (such as: select * from Users where UserName + ‘ pig’ = ‘Zhang San pig’), the Like operation in front of the wildcard (such as: select…