I have a table w1000, there are 10 million data, this table structure is as follows:CREATE TABLE ' w1000 ' (' ID ' varchar ($) Not NULL,' Name ' varchar () DEFAULT NULL,' Age ' int (3) DEFAULT NULL,' Money ' double (8,2) DEFAULT NULL,' Address '
CREATE TABLE tab2 as (SELECT * from TAB1)The storage engine for this practice table also uses the server's default storage engine instead of the source table's storage engine, which copies the contents of the table together.CREATE talbe tab2
The common rules for indexing are as follows:1, the table's primary key, the foreign key must have the index;2, the data volume of more than 300 of the table should be indexed;3. Tables that are often connected to other tables should be indexed on
Because too many indexes and inadequate, incorrect indexes are not good for performance: Each index created on a table increases storage overhead, and indexing increases processing overhead for inserts, deletes, and updates.
In addition, too many
mysql The index is used in two ways after the index is created: 1 is automatically determined by the query optimizer of the database to use the index; 2 users can force the index to be used when writing SQL statements The following is a
Abstract: This article will introduce how to optimize the performance of the database system to process various queries as quickly as possible. The function of indexes in optimizing queries includes the principle of optimizing indexes. indexes are
MySQL database index
Advantages of creating an index in MySQL:
1. Greatly speed up data retrieval;
2. Create a unique index to ensure the uniqueness of each row of data in the database table;
3. Accelerate the connection between tables;
4. When you
How to create an index in mysql bitsCN. com1. add a primary key (primary key index)
Mysql> alter table 'Table _ name' add primary key ('column ')
2. add UNIQUE (UNIQUE index)
Mysql> alter table 'Table _ name' add unique (
'Column'
)
3. add an
MySQL commonly used statements for table creation, adding fields, modifying fields, and adding indexes.
This article describes the common SQL statements used by MySQL to create tables, add fields, modify fields, and add indexes. We will share this
Use of MySQL Indexes
We will first discuss the index, because it is the most important tool to speed up the query. There are other technologies for accelerating queries, but the most effective one is to properly use indexes. On the MySQL Mail List,
Objective
Index is the data structure that helps MySQL get data efficiently. It is critical for high performance, but people often forget or misunderstand it. Indexes are more important when the data is larger. Small, lightweight databases can have
What is an indexIndexes are used to quickly look for records with specific values, and all MySQL indexes are saved as B-trees. If there is no index, MySQL must start scanning all records of the entire table from the first record until it finds a
Usage: Explain select * from Ems_expense_feedback where expenseid=333 The rows column represents the number of times the SQL execution was retrieved, the smaller the better Add an appropriate index to the above results 1. Add primary key (primary
If there is too much data in the table, it will affect the efficiency of the query, then we need to find a way to optimize the query, usually adding an index is one of our choices;1. Add primary key (primary key index)Mysql>alter TABLE ' table_name '
Tian Teacher, le Study medical examination of the question statistics,The record has 50w, statistics to more than 20 minutesOptimized SQL and indexed, response in 0.1 secondsSHOW INDEX from ' Exam_question_record ';ALTER TABLE ' Exam_question_record
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.