Database system Learning (ix)-index

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.