SQL Server索引的工作原理 [英] How SQL Server indexing works

查看:137
本文介绍了SQL Server索引的工作原理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SQL Server使用带有中间节点和叶节点的二叉树进行搜索,但是如何执行此操作。防爆。如果一个表员工有两个字段

SQL Server uses binary tree with intermediate and leaf node for search but how it will do this. Ex. If a table employee has two fields

Id bigint 
Name varchar(50) 

,其值为

Id                  Name
1                   Ashish
2                   Amit 
3                   Bhavin
4                   Dinesh 

如果我们在这两列上创建了复合非聚集索引,其名称为first,而Id之后为Id。中间节点是否包含1)A-F 2)G-M ......或其他内容。此外,一旦使用二进制搜索名称,则在此树之后,id具有中间节点。

If we have created composite non-clustered index on both of this columns with name as first and Id after this than how it work. Whether intermediate nodes contain 1) A-F 2)G-M ... or something else. Also once name is searched in binary then after this tree has id has intermediate node.

简而言之,SQL服务器如何在这种条件下搜索?

In short how does SQL server search in this type of conditions?

推荐答案

工作原理

数据库采用列在CREATE INDEX命令中指定,并将值排序到称为B树的特殊数据结构中。 B树结构支持使用最少量的磁盘读取进行快速搜索,允许数据库引擎快速找到我们正在使用的查询的起始点和停止点。

The database takes the columns specified in a CREATE INDEX command and sorts the values into a special data structure known as a B-tree. A B-tree structure supports fast searches with a minimum amount of disk reads, allowing the database engine to quickly find the starting and stopping points for the query we are using.

有关详情,请查看这个!

For more info, check THIS!

这篇关于SQL Server索引的工作原理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆