索引sql server

In the previous articles of this series, we described the structure of the SQL Server tables and indexes, the main concepts that are used to describe the index and the basics and guidelines that are used to design the proper index. In this article, we will go through the operations that can be performed on the SQL Server indexes.

在本系列的前几篇文章中 ,我们描述了SQL Server表和索引的结构,用于描述索引的主要概念以及用于设计适当索引的基础和准则。 在本文中,我们将介绍可以在SQL Server索引上执行的操作。

创建索引 (Creating Indexes)

Before creating an index, it is better to follow the index design guidelines and best practices that are described in the previous article, to determine the columns that will participate in the index, the type of the created index, the suitable index options, such as the FillFactor or Sort in TempDB, and the storage location of that index.

在创建索引之前,最好遵循上一篇文章中描述的索引设计准则和最佳实践,以确定将参与索引的列,创建的索引的类型,合适的索引选项,例如在TempDB中的FillFactor或Sort,以及该索引的存储位置。

A SQL Server index can be created using the CREATE INDEX T-SQL statement or from the New Index dialog box using the SQL Server Management Studio tool, by providing

可以使用CREATE INDEX T-SQL语句或使用SQL Server Management Studio工具从“ 新建索引”对话框中创建SQL Server索引,方法是提供

  • the index name, 索引名称,
  • the index type, 索引类型,
  • the uniqueness of the index key values, 索引键值的唯一性,
  • the name of the table on which the index will be created, 将在其上创建索引的表的名称,
  • list of columns that will participate in that index 将参与该索引的列的列表
  • and different index options such as the FillFactor, Sort in TempDB, drop the existing similar indexes 和不同的索引选项(例如FillFactor,在TempDB中排序)删除现有的相似索引
  • and the index filegroup and location 以及索引文件组和位置

The CREATE INDEX T-SQL syntax below is used as a template to create a new SQL Server index. The absence of the UNIQUE option will not force the uniqueness of the index key values. In the unique index, no two rows are permitted to have the same index key value. If the type of the index is not specified in the CREATE INDEX T-SQL statement, a Non-Clustered index will be created.

下面的CREATE INDEX T-SQL语法用作创建新SQL Server索引的模板。 缺少UNIQUE选项不会强制索引键值的唯一性。 在唯一索引中,不允许两行具有相同的索引键值。 如果在CREATE INDEX T-SQL语句中未指定索引的类型,则将创建非聚集索引。

CREATE [UNIQUE] [ CLUSTERED | NONCLUSTERED ] INDEX [index_name] ON [TableName]
([Column1] ASC,[Column2] ASC
) ON PRIMARY
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO

The same operation can be performed using SQL Server Management Studio, by browsing the table on which you need to create an index, right click on the Indexes node and choose New Index option, from which you can specify the type of the index to be created, as shown below:

使用SQL Server Management Studio,可以通过浏览需要在其上创建索引的表,右键单击“索引”节点并选择“ 新建索引”选项来执行相同的操作,从中可以指定要创建的索引的类型。 , 如下所示:

From the General tab of the displayed New Index dialog box, the name of the table will be filled automatically, with an editable suggested name of the index. The type of the index will be also filled automatically from the provided types list, with the ability to specify the uniqueness of that index and list of columns that will be added to that index and the order of each column, as shown clearly below:

在显示的“新建索引”对话框的“ 常规”选项卡中,表的名称将自动填充,并带有建议的可编辑索引名称。 索引的类型也将从提供的类型列表中自动填充,并具有指定该索引的唯一性以及将添加到该索引的列列表以及每一列的顺序的功能,如下所示:

In the Options tab of the New Index dialog box, you can change the default values of the different index creation options, same as the ones specified in the WITH clause of the CREATE INDEX T-SQL statement, as shown below:

在“新建索引”对话框的“ 选项”选项卡中,可以更改不同索引创建选项的默认值,这些默认值与CREATE INDEX T-SQL语句的WITH子句中指定的选项相同,如下所示:

The storage location setting of the index, such as the filegroup and the partition schema in which the index will be stored, can be specified in the Storage tab of the New Index dialog box, as shown below:

可以在“新建索引”对话框的“ 存储”选项卡中指定索引的存储位置设置,例如将在其中存储索引的文件组和分区架构,如下所示:

From the Filter tab of the New Index dialog box, you can specify the WHERE condition of the filtered index, to select the data to be stored in the created filtered index, as shown below:

在“新建索引”对话框的“ 过滤器”选项卡上,可以指定过滤索引的WHERE条件,以选择要存储在创建的过滤索引中的数据,如下所示:

SQL Server indexes can be also created indirectly by defining the PRIMARY KEY and the UNIQUE constraint within the CREATE TABLE or ALTER TABLE statements. SQL Server will create a unique clustered index to enforce the PRIMARY KEY constraint unless you already define a clustered index on that table. Recall that we cannot create more one clustered index on each table. A unique non-clustered index will be created automatically to enforce the UNIQUE constraint. You should be granted CONTROL or ALTER permission on the table in order to be able to can create an index.

还可以通过在CREATE TABLE或ALTER TABLE语句中定义PRIMARY KEY和UNIQUE约束来间接创建SQL Server索引。 SQL Server将创建一个唯一的聚集索引来强制执行PRIMARY KEY约束,除非您已经在该表上定义了聚集索引。 回想一下,我们不能在每个表上创建一个以上的聚集索引。 将自动创建一个唯一的非聚集索引,以强制执行UNIQUE约束。 您应该被授予对表的CONTROL或ALTER权限,以便能够创建索引。

Assume that we plan to create the below table that contains two columns, the ID column as PRIMARY KEY and the UNIQUE column STD_Name, using the CREATE Table T-SQL statement below:

假设我们计划使用下面的CREATE Table T-SQL语句创建包含两列的下表,即ID列为PRIMARY KEY和UNIQUE列STD_Name:

USE SQLShackDemo
GO
CREATE TABLE IndexDemo
( ID INT IDENTITY (1,1) PRIMARY KEY,STD_Name NVARCHAR(50)  NOT NULL UNIQUE)

Checking the created table from the object explorer of the SQL Server Management Studio, you will see that, two new indexes will be created on that table automatically, without providing any CREATE INDEX statement. A Clustered index will be created to enforce the PRIMARY KEY constraint and a Unique Non-Clustered index will be created to enforce the UNIQUE constraint, as shown below:

从SQL Server Management Studio的对象资源管理器检查创建的表,您将看到,将在该表上自动创建两个新索引,而无需提供任何CREATE INDEX语句。 将创建一个聚簇索引来强制执行PRIMARY KEY约束,并创建一个唯一非聚簇索引来强制执行UNIQUE约束,如下所示:

Creating new indexes on large tables should be planned carefully, due to the performance impact of this process in a production environment. You need plan carefully starting with the clustered index creation, after that you can create the Non-clustered indexes over it.

由于该过程在生产环境中的性能影响,应仔细计划在大表上创建新索引的过程。 从创建聚簇索引开始,您需要仔细计划,然后才能在其上创建非聚簇索引。

Also, setting the ONLINE option to ON when you create the index will enable other data retrieving or modification processes on the underlying table to continue, preventing the index creation process from locking the table. On the other hand, the ONLINE index creation process will take longer time than the offline default index creation process.

此外,在创建索引时将ONLINE选项设置为ON将使基础表上的其他数据检索或修改过程能够继续进行,从而防止索引创建过程锁定表。 另一方面,在线索引创建过程将比离线默认索引创建过程花费更长的时间。

Using the SORT_IN_TEMPDB option can also help in reducing the time required to create the index, taking into consideration that the tempdb is hosted on a separate disk drive than the user database.

考虑到tempdb托管在与用户数据库不同的磁盘驱动器上,因此使用SORT_IN_TEMPDB选项还可以帮助减少创建索引所需的时间。

SQL Server allows us to create up to one clustered index, 999 non-clustered indexes, 249 XML indexes, 249 Spatial indexes on each table. You can add up to 16 key columns per index, with maximum allowed size for index key record equal to 900 bytes. It is not allowed to add columns with image, ntexttextvarchar(max)nvarchar(max)varbinary(max), and xml datatypes to the index key. The number, record size and datatypes limitation of index key columns can be avoided by including Non-Key columns in the index, as we will see in details in the Designing Effective Non-clustered Index article.

SQL Server允许我们在每个表上最多创建一个聚集索引,999个非聚集索引,249个XML索引,249个空间索引。 每个索引最多可以添加16个键列,索引键记录的最大允许大小等于900字节。 不允许将具有imagentexttextvarchar(max)nvarchar(max)varbinary(max)xml数据类型的列添加到索引键。 通过在索引中包括非关键列,可以避免索引关键列的数量,记录大小和数据类型的限制,正如我们将在“设计有效的非聚集索引”文章中详细介绍的那样。

禁用索引 (Disabling Indexes)

When you disable a SQL Server index, the definition, statistics and the data of that index will not be removed from the system catalog, but you will not be able to access that index. Disabling the Non-clustered index will prevent you from accessing that index only. On the other hand, disabling the clustered index will prevent you from accessing the underlying table’s data, until you drop or rebuild the index.

禁用SQL Server索引时,该索引的定义,统计信息和数据不会从系统目录中删除,但是您将无法访问该索引。 禁用非聚集索引将阻止您仅访问该索引。 另一方面,禁用聚簇索引将阻止您访问基础表的数据,直到您删除或重建索引为止。

You may decide to disable an index temporarily for many purposes, such as troubleshooting a specific scenario, correcting a disk I/O error before rebuilding the index, or eliminating the temporary disk space required to store the old and new version of the index during the index rebuild process, where only 20 percent if the index size will be required for sorting the index data.

您可能出于多种目的决定暂时禁用索引,例如对特定情况进行故障排除,在重建索引之前更正磁盘I / O错误,或消除在存储过程中存储旧版本和新版本索引所需的临时磁盘空间。索引重建过程,如果对索引数据进行排序仅需要索引大小,则只有20%。

The SQL Server Engine disables database indexes that may contain an expression, database object or collation that could be changed or may conflict with a change in the upgrade process, automatically when an upgrade process to a new release or Service Pack for SQL Server is performed, and rebuilds it automatically once the upgrade process is completed successfully.

当执行到SQL Server的新版本或Service Pack的升级过程时,SQL Server引擎会自动禁用可能包含表达式,数据库对象或排序规则的数据库索引,这些表达式,数据库对象或排序规则可能会更改或与升级过程中的更改冲突。并在升级过程成功完成后自动重建它。

An index can be disabled manually using the ALTER INDEX DISABLE T-SQL statement. In the previously created IndexDemo table, if we plan to disable the Non-clustered index, that is used to enforce the uniqueness of the STD_Name column, using the ALTER INDEX DISABLE T-SQL statement, and check the execution plan of the below simple SELECT statement before and after disabling the index:

可以使用ALTER INDEX DISABLE T-SQL语句手动禁用索引 。 在先前创建的IndexDemo表中,如果我们计划禁用非聚集索引,该索引用于使用ALTER INDEX DISABLE T-SQL语句强制执行STD_Name列的唯一性,并检查以下简单SELECT的执行计划禁用索引前后的声明:

SELECT * FROM IndexDemo WHERE STD_Name ='CC'
GO
ALTER INDEX [UQ__IndexDem__6F98476D087DAAD3] ON [IndexDemo] DISABLE
GO
SELECT * FROM IndexDemo WHERE STD_Name ='CC'
GO

You will see that the SQL Server Engine performs an Index Seek on the Non-Clustered index to get the requested data in the first SELECT query. After disabling the Non-clustered index, the index is no longer accessible. So that, the SQL Server Engine performs an index scan on the clustered index, as shown clearly below:

您将看到SQL Server Engine对非聚集索引执行索引查找以在第一个SELECT查询中获取请求的数据。 禁用非聚集索引后,将无法再访问该索引。 因此,SQL Server Engine对聚集索引执行索引扫描,如下所示:

If we try to disable the clustered index this time, using the ALTER INDEX DISABLE T-SQL statement, then try to run the same SELECT statement on that table:

如果这次我们尝试使用ALTER INDEX DISABLE T-SQL语句禁用聚集索引,则尝试在该表上运行相同的SELECT语句:

ALTER INDEX [PK__IndexDem__3214EC27DF7B8FBD] ON [IndexDemo] DISABLE
GO
SELECT * FROM IndexDemo WHERE STD_Name ='CC'
GO

The SELECT query will fail, showing that the table is no longer accessible after disabling the clustered index on the table, as shown in the error message below:

SELECT查询将失败,显示在禁用表上的聚集索引后,该表不再可访问,如以下错误消息所示:

The disabled index can be enabled again by rebuilding the index using the ALTER INDEX REBUILD T-SQL statement or creating the index again using the CREATE INDEX T-SQL statement with the DROP_EXISTING option equal to ON. If we manage to enable the clustered index on the demo table again using the ALTER INDEX REBUILD T-SQL statement below, then trying to run the same SELECT statement:

可以通过使用ALTER INDEX REBUILD T-SQL语句重建索引或使用带有DROP_EXISTING选项等于ON的CREATE INDEX T-SQL语句再次创建索引来再次启用禁用的索引。 如果我们设法使用下面的ALTER INDEX REBUILD T-SQL语句再次在演示表上启用聚簇索引,则尝试运行相同的SELECT语句:

ALTER INDEX [PK__IndexDem__3214EC27DF7B8FBD] ON [IndexDemo] REBUILD
GO
SELECT * FROM IndexDemo WHERE STD_Name ='CC'
GO

You will see that you are able now to access that table and retrieve the requested data, as shown below:

您将看到现在可以访问该表并检索所请求的数据,如下所示:

Also, enabling the Non-clustered index, using the CREATE INDEX WITH DROP_EXISTING T-SQL statement below:

另外,使用下面的CREATE INDEX WITH DROP_EXISTING T-SQL语句启用非聚集索引:

SELECT * FROM IndexDemo WHERE STD_Name ='CC'
GO
CREATE UNIQUE INDEX [UQ__IndexDem__6F98476D087DAAD3] ON [IndexDemo] (STD_Name) WITH (DROP_EXISTING =ON)
GO
SELECT * FROM IndexDemo WHERE STD_Name ='CC'
GO

You will see that the SQL Server Engine seeks that index directly after enabling it, compared with scanning the clustered index before enabling the Non-clustered index, as shown below:

与启用非群集索引之前扫描群集索引相比,您将看到SQL Server Engine在启用索引之后立即查找该索引,如下所示:

重命名索引 (Renaming Indexes)

It is better to follow a standard naming convention when creating the SQL Server indexes, to understand the purpose of that index from the index name. You can specify the type of the index, the name of the table on which the index is created and the name of the columns that participate in that index, in the index name to make it meaningful and unique at the table level. For existing indexes, you can replace the current index name with a new name that follows your company naming convention policy. Renaming the index will not affect the index structure or rebuild it, it will just change the name of that index.

创建SQL Server索引时,最好遵循标准的命名约定,以便从索引名称中了解该索引的用途。 您可以在索引名称中指定索引的类型,在其上创建索引的表的名称以及参与该索引的列的名称,以使其在表级别有意义且唯一。 对于现有索引,可以使用遵循公司命名约定策略的新名称替换当前索引名称。 重命名索引不会影响索引结构或重建索引结构,只会更改该索引的名称。

For example, when you create a PRIMARY KEY or UNIQUE constraints, SQL Server will create a related index automatically to enforce that constraint, providing a long name that contains the type of that constraint, the table name and a unique GUID value as shown in the previous example.

例如,当您创建PRIMARY KEY或UNIQUE约束时,SQL Server将自动创建一个相关索引以强制执行该约束,并提供一个包含该约束类型,表名和唯一GUID值的长名称,如前面的例子。

The sp_rename system procedure can be used to change the name of the index, by providing the old index name and the new index name. The below T-SQL statement is used to change the name of the automatically created Non-clustered index to follow our naming convention:

通过提供旧的索引名称和新的索引名称,可以使用sp_rename系统过程来更改索引的名称。 下面的T-SQL语句用于更改自动创建的非聚集索引的名称,以遵循我们的命名约定:

EXEC sp_rename N'IndexDemo.UQ__IndexDem__6F98476D087DAAD3', N'UQ_IndexDemo_STD_Name', N'INDEX';

The new name can be checked from the Indexes node of the target table using the SQL Server Management Studio, as shown below:

可以使用SQL Server Management Studio从目标表的“索引”节点中检查新名称,如下所示:

下降索引 (Dropping Indexes)

As describe the SQL Server index, always remember that it is a double-edged sword that can negatively affect system performance in cases when the index is badly designed. If it is found that an index is badly designed, or it is no longer needed, you will need to drop that index from the database table and reclaim the disk space consumed by the index to be used by another database objects. Dropping the table or view will also drop all indexes created on that database object.

在描述SQL Server索引时,请始终记住,它是一把双刃剑 ,在索引设计不良的情况下,可能会对系统性能产生负面影响。 如果发现索引设计不良或不再需要该索引,则需要从数据库表中删除该索引,并回收该索引消耗的磁盘空间以供其他数据库对象使用。 删除表或视图也将删除在该数据库对象上创建的所有索引。

Dropping the clustered index will take extra time and temporary disk space. This is due to the fact that, all the data stored in the leaf level of the clustered index will be stored in an unordered heap table. In addition, all Non-clustered indexes will be rebuilt to replace the clustered index keys with row pointers to the heap table. You can also perform an online drop for the clustered index, with the ability to override the default database MAXDOP value for the current clustered index drop query only. In this case, other user queries that use the underlying table will not be blocked by the DROP INDEX operation.

删除群集索引将花费额外的时间和临时磁盘空间。 这是由于以下事实:聚集索引的叶级中存储的所有数据都将存储在无序堆表中。 另外,将重新构建所有非聚集索引,以使用指向堆表的行指针替换聚集索引键。 您还可以对聚集索引执行联机删除,并能够仅对当前聚集索引删除查询覆盖默认数据库MAXDOP值。 在这种情况下,使用基础表的其他用户查询将不会被DROP INDEX操作阻止。

An index can be dropped easily using the DROP INDEX T-SQL statement, by providing the index name and the name of the table on which the index is created, as shown below:

通过提供索引名称和在其上创建索引的表的名称,可以使用DROP INDEX T-SQL语句轻松删除索引,如下所示:

DROP INDEX [UQ_IndexDemo_STD_Name] ON [dbo].[IndexDemo]

For manually created indexes, the DROP INDEX will be useful to drop the index. But for the indexes that are created automatically to enforce the PRIMARY KEY and UNIQUE constraints, you will not be able to drop it unless you drop the constraint that created the index. If you try to run the previous DROP INDEX statement to drop the index created to enforce the UNIQUE key constraint, the statement will fail, showing that the index is used for the UNIQUE KEY constraint, as shown below:

对于手动创建的索引,DROP INDEX将对删除索引很有用。 但是,对于为强制执行PRIMARY KEY和UNIQUE约束而自动创建的索引,除非删除创建索引的约束,否则将无法删除它。 如果您尝试运行前面的DROP INDEX语句来删除为实施UNIQUE键约束而创建的索引,则该语句将失败,表明该索引用于UNIQUE KEY约束,如下所示:

To drop the previous index, we should drop the parent constraint, using the ALTER TABLE DROP CONSTRAINT T-SQL statement below:

要删除先前的索引,我们应该使用下面的ALTER TABLE DROP CONSTRAINT T-SQL语句删除父约束:

ALTER TABLE [dbo].[IndexDemo] DROP CONSTRAINT [UQ_IndexDemo_STD_Name]

That will drop the index automatically as shown below:

这将自动删除索引,如下所示:

设置索引选项 (Setting Index Options)

When you create or rebuild an index, there is a number of index options to be considered and set. These options include:

创建或重建索引时,需要考虑和设置许多索引选项。 这些选项包括:

  • PAD_INDEX: Used to apply the free space percentage specified by FillFactor to the index intermediate level pages during index creation. PAD_INDEX :用于在创建索引期间将FillFactor指定的可用空间百分比应用于索引中间级别页面。
  • FILLFACTOR: Used to set the percentage of free space that the SQL Server Engine will leave in the leaf level of each index page during the index creation. FillFactor should be an integer value from 0 to 100, with 0 or 100 is the default value, in which the pages will be filled completely during the index creation. FILLFACTOR :用于设置在创建索引期间,SQL Server引擎将在每个索引页的叶级中保留的可用空间的百分比。 FillFactor应该是从0到100的整数值,其中0或100是默认值,在该值中将在创建索引期间完全填充页面。
  • SORT_IN_TEMPDB: Specifies whether the intermediate sort results, generated during index creation, will be stored in SORT_IN_TEMPDB :指定是否将在索引创建期间生成的中间排序结果存储在tempdb. tempdb中 。
  • IGNORE_DUP_KEY: Specifies if an error message will be shown when duplicate key values are inserted into the unique index. IGNORE_DUP_KEY :指定将重复的键值插入唯一索引时是否显示错误消息。
  • STATISTICS_NORECOMPUTE: Determines if the outdated index distribution statistics will be recomputed automatically. STATISTICS_NORECOMPUTE :确定是否将自动重新计算过时的索引分布统计信息。
  • DROP_EXISTING: Specifies that the named existing index will be dropped and recreated again. DROP_EXISTING :指定将删除已命名的现有索引并重新创建。
  • ONLINE: Specifies whether the underlying tables are accessible for queries and data modification during the index operation.  ONLINE :指定在索引操作期间是否可访问基础表以进行查询和数据修改。
  • ALLOW_ROW_LOCKS: Determines whether row locks are allowed to access the index data. ALLOW_ROW_LOCKS :确定是否允许行锁访问索引数据。
  • ALLOW_PAGE_LOCKS: Determines whether page locks are allowed to access the index data. ALLOW_PAGE_LOCKS :确定是否允许页面锁访问索引数据。
  • MAXDOP: Used to limit the maximum number of processors used in a parallel plan execution of the index operation. MAXDOP :用于限制在索引操作的并行计划执行中使用的最大处理器数量。
  • DATA_COMPRESSION: Specifies the data compression level for the specified index, partition number, or range of partitions, with NONE, ROW, and PAGE values. DATA_COMPRESSION :使用NONE,ROW和PAGE值指定指定索引,分区号或分区范围的数据压缩级别。

You can view the current values of these options for a specific index by querying the sys.indexes catalog view, using the SELECT statement below:

您可以通过使用以下SELECT语句查询sys.indexes目录视图来查看特定索引的这些选项的当前值:

SELECT *
FROM sys.indexes
WHERE name = N'PK__IndexDem__3214EC27DF7B8FBD';
GO

A snapshot of the returned result will be like:

返回结果的快照类似于:

The below CREATE INDEX query is used to create a new index on the demo table, with a customized value for the FillFactor option, applying the FillFactor value to the intermediate level pages, as shown below:

下面的CREATE INDEX查询用于在演示表上创建一个新索引,并使用FillFactor选项的自定义值,将FillFactor值应用于中间级别页面,如下所示:

CREATE INDEX IX_IndexDemo_STDName
ON [dbo].[IndexDemo] (STD_Name)
WITH (PAD_INDEX=ON, FILLFACTOR=90)

The following ALTER INDEX query is used to rebuild the index, allowing the Row lock type during the index rebuild process:

以下ALTER INDEX查询用于重建索引,从而在重建索引过程中允许使用行锁类型:

ALTER INDEX IX_IndexDemo_STDName
ON [dbo].[IndexDemo] REBUILD
WITH (ALLOW_ROW_LOCKS=ON)

You can also use the SET clause with the ALTER INDEX statement to set the ALLOW_PAGE_LOCKS, ALLOW_ROW_LOCKS, IGNORE_DUP_KEY and STATISTICS_NORECOMPUTE options without the need to rebuild the index, as in the ALTER INDEX statement below:

您还可以将SET子句与ALTER INDEX语句一起使用,以设置ALLOW_PAGE_LOCKS,ALLOW_ROW_LOCKS,IGNORE_DUP_KEY和STATISTICS_NORECOMPUTE选项,而无需重建索引,如下面的ALTER INDEX语句所示:

ALTER INDEX IX_IndexDemo_STDName
ON [dbo].[IndexDemo]
SET (ALLOW_PAGE_LOCKS=ON)

Remember that the ALTER INDEX T-SQL statement cannot be used to change the structure or participating columns of the index, it just allows you to Rebuild, Reorganize or SET the different index options.

请记住,ALTER INDEX T-SQL语句不能用于更改索引的结构或参与列,它仅允许您重建,重新组织或设置不同的索引选项。

Until this point, we show deeply most of the operations that can be performed on the SQL Server indexes. In the next articles in this series, we will describe how to design a useful and effective clustered index. Stay tuned!

在此之前,我们深入展示了可以在SQL Server索引上执行的大多数操作。 在本系列的下一篇文章中,我们将描述如何设计一个有用且有效的聚簇索引。 敬请关注!

目录 (Table of contents)

SQL Server indexes – series intro
SQL Server table structure overview
SQL Server index structure and concepts
SQL Server index design basics and guidelines
SQL Server index operations
Designing effective SQL Server clustered indexes
Designing effective SQL Server non-clustered indexes
Working with different SQL Server indexes types
Tracing and tuning queries using SQL Server indexes
Gathering SQL Server index statistics and usage information
Maintaining SQL Server Indexes
Top 25 interview questions and answers about SQL Server indexes
SQL Server索引–系列介绍
SQL Server表结构概述
SQL Server索引结构和概念
SQL Server索引设计基础和准则
SQL Server索引操作
设计有效SQL Server群集索引
设计有效SQL Server非聚集索引
使用不同SQL Server索引类型
使用SQL Server索引跟踪和调整查询
收集SQL Server索引统计信息和使用情况信息
维护SQL Server索引
有关SQL Server索引的25个最佳面试问答

翻译自: https://www.sqlshack.com/sql-server-index-operations/

索引sql server

索引sql server_SQL Server索引操作相关推荐

  1. 索引sql server_SQL Server索引–系列介绍

    索引sql server 描述 (Description) In this series, we will dive deeply in the SQL Server Indexing field, ...

  2. 索引sql server_SQL Server索引结构和概念

    索引sql server In my previous article, SQL Server Table Structure Overview, we described, in detail, t ...

  3. 索引sql server_SQL Server索引设计基础和准则

    索引sql server In the previous article of this series, SQL Server Index Structure and Concepts, we des ...

  4. 索引sql server_SQL Server索引设计的五个主要注意事项

    索引sql server In this article, we will discuss the most important points that we should consider when ...

  5. 索引sql server_SQL Server索引与统计顾问的困境或麻烦

    索引sql server As a DBA, I am often asked why is something performing slow, what and why statistics ne ...

  6. 索引sql server_SQL Server报告– SQL Server索引利用率

    索引sql server Understanding indexing needs allows us to ensure that important processes run efficient ...

  7. java 调试sql server_sql server 如何调试存储过程

    PHP面试干货 1.进程和线程 进程和线程都是由操作系统所体会的程序运行的基本单元,系统利用该基本单元实现系统对应用的并发性.进程和线程的区别在于: 简而言之,一个程序至少有一个进程,一个进程至少有一 ...

  8. 游标sql server_SQL Server游标性能问题

    游标sql server 介绍 (Introduction) 在上一篇文章中,我们讨论了如何设置基本游标. 我们解释了游标是基于行的操作,它采用给定的SELECT语句并将数据处理分解为循环执行. 没有 ...

  9. 游标sql server_SQL Server游标教程

    游标sql server 介绍 (Introduction) 大多数使用Microsoft SQL Server的人至少会听说过游标,而且即使人们基本了解SQL Server游标的作用,他们也不总是确 ...

最新文章

  1. 【React 实战教程】从0到1 构建 github star管理工具
  2. 光子人工智能芯片助“中国芯”换道超车
  3. 一招一式攻克linux(四)
  4. 第K极值(Tyvj)
  5. DCMTK:测试DcmItem的newDicomElement()辅助方法
  6. CCNA认证(1)--CCNA简介
  7. C++之函数的默认值参数说明
  8. Educational Codeforces Round 32 G. Xor-MST 01tire + 分治 + Boruvka
  9. 大数据入门:各种大数据技术的介绍
  10. jmeter服务器性能资源监控部署
  11. 【Python】WordCloud库的使用
  12. win10系统配置服务器地址,win10系统配置服务器地址
  13. Python数据可视化案例一:自定义曲线频率、颜色与线型
  14. SQL Server-流程控制 6,WaitFor 语句
  15. 万创帮逆向解析,让你也能体验技术变现【Python爬虫实战系列之万创帮闲置资源整合逆向】
  16. Pycharm官网下载安装
  17. uniapp 微信小程序 生成海报
  18. MQTT介绍,服务器(EMQ X)搭建,客户端(mqtt-spy,安卓)使用,java编程示例
  19. 解决在iOS复制失败问题 iOS/Android通用
  20. [项目记录]用vue-electron搭建pc网易云音乐程序(2)——搭建基本页面

热门文章

  1. python导入random模块_python random模块(随机数)详解
  2. RS485 RS232
  3. 20172327 2018-2019-1 《程序设计与数据结构》第五周学习总结
  4. yafu安装使用方法以及mismatched parens解决方法
  5. 委托和事件[delegate and event]_C#
  6. 对HGE游戏引擎的一次封装
  7. Access 中数据库操作时提示from子句语法错误
  8. SQLServer查询最近一天,三天,一周,一月,一季度方法
  9. SQL with(unlock)与with(readpast)
  10. 一个axios的简单教程