1. Use of indexes
--Create a tableCreate TableT_user (Idint Primary Key Identity(1,1), UNonvarchar(Ten), UNamenvarchar(Ten), Uageint)--Create an index (to index a field uname)Create IndexIdx_user_name onT_user (UName)--Delete IndexDrop IndexIdx_user_name onT_user
2. What is an index
Index is a data structure that helps MSSQL efficiently get
3. Why use an index
A. Uniqueness of the index, which guarantees the uniqueness of each row of data
B. Greatly accelerate the speed of data retrieval to
C. Accelerating the connection between tables and tables
4. Disadvantages of the Index
A. Creating indexes and maintaining indexes can be time-consuming
B. Each index must occupy a certain physical space
C. The data in the table, delete, change the operation, index page to dynamic maintenance, reduce the data maintenance speed
4. Which columns can be used
A. Columns that often need to be searched, like some foreign keys
B. On the primary key column, enforce the uniqueness of the column
C. Use the columns in the WHERE clause frequently, because the index is sorted
5. Which columns are not recommended for use
A. Columns that are seldom used in queries
B. Columns with only a few data
C. Columns with a data type of text,image,bit because of the large amount of data
D. When the modification performance is greater than the index performance
Database system Learning (ix)-index