arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1903.08334cs.DB
收藏

Microsoft SQL Server中的索引

Indexes in Microsoft SQL Server

Sourav Mukherjee

摘要:

索引是快速检索记录的最佳选择。这只不过是减少了磁盘IO的数量。我们可以使用索引结构(如B树或哈希索引)来更快地检索数据,而不是扫描整个表以获得结果,从而减少IO或页面获取的数量。考虑索引最方便的方法是像字典一样思考。它有单词和与这些单词对应的定义。字典将有一个关于“word”的索引,因为当我们打开字典时,我们想快速获取相应的单词,然后找到它的定义。词典通常只包含一个索引--按单词排序的索引。当我们修改任何记录并更改聚集索引中索引列的相应值时,数据库可能需要将整行移动到一个单独的新位置,以保持行的排序顺序。这个操作实质上是将一个更新查询转换为一个更新查询,然后是一个更新查询,这会降低查询的性能。表中的聚集索引通常可用于主键码或外键列,因为一旦将记录注入数据库,键值通常不会修改。

英文摘要:

Indexes are the best apposite choice for quickly retrieving the records. This is nothing but cutting down the number of Disk IO. Instead of scanning the complete table for the results, we can decrease the number of IO's or page fetches using index structures such as B-Trees or Hash Indexes to retrieve the data faster. The most convenient way to consider an index is to think like a dictionary. It has words and its corresponding definitions against those words. The dictionary will have an index on "word" because when we open a dictionary and we want to fetch its corresponding word quickly, then find its definition. The dictionary generally contains just a single index - an index ordered by word. When we modify any record and change the corresponding value of an indexed column in a clustered index, the database might require moving the entire row into a separately new position to maintain the rows in the sorted order. This action is essentially turned into an update query into a DELETE followed by an INSERT, and it decreases the performance of the query. The clustered index in the table can often be available on the primary key or a foreign key column because key values usually do not modify once a record is injected into the database.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑