Overview

This topic describes the precautions for RDS SQL Server to create a clustered index.

 

Detail

Alibaba Cloud reminds you that:

  • Before you perform operations that may cause risks, such as modifying instance configurations or data, we recommend that you check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
  • You can modify the configurations and data of instances including but not limited to Elastic Compute Service (ECS) and Relational Database Service (RDS) instances. Before the modification, we recommend that you create snapshots or enable RDS log backup.
  • If you have authorized or submitted security information such as the logon account and password in the Alibaba Cloud Management console, we recommend that you modify such information in a timely manner.

We recommend that you create clustered indexes for each table.

 

You can create only one clustered index for each table.

If you have created clustered indexes, creation fails again and the error is as follows.
重复创建报错
 

Use sp_helpindex to view indexes

Run the following SQL statements in sequence to view the index:
ues  [$DB_Name] go sp_helpindex '[$Table_Name]'

Note:

  • [$DB_Name] is the database name.
  • [$Table_Name] is the table name.

 

Use drop index to delete a clustered index

Run the following SQL statements in sequence to delete the clustered index:
DROP INDEX [$Index_Name] ON [$DB_Name].[ $Table_Name]

Note:[$Index_Name] is the index name.

 

Recalculate statistics

Statistics refers to the STATISTICS_NORECOMPUTE options when creating the index. Generally, recalculation is required. For more information, see CREATEINDEX.

Note: The default value of STATISTICS_NORECOMPUTE is OFF, which means that recalculation is required, because this option itself is negative.
 
 

Application scope

  • ApsaraDB RDS for SQL Server