Explain shows how MySQL uses indexes to process SELECT statements and join tables. Can help select better indexes and write more optimized query statements. Using the method, add explain to the SELECT statement: Such as: EXPLAIN SELECT ' surname ','
MySQL index and optimization Query
An appropriate index can accelerate the query speed. There are four types: primary key, unique index, full-text index, and common index.
Primary Key: It is unique and has no null value.Create table pk_test (f1 int
MYSQLexplain execution plan MySQLexplain
BitsCN.com:
Example: explain select * from test1
Description of the EXPLAIN column:
Table: displays the data of this row about which table
Type: this is an important column that shows the type used by the
Here we will introduce the EXPLAIN command in MySQL, and hope to help you explain how mysql uses indexes to process select statements and connect tables. It can help you select better indexes and write more optimized query statements.
You can add
I have encountered some database problems during performance tests recently. I usually use slow query logs to find SQL statements with poor execution performance. However, I cannot find these SQL statements only,
I have encountered some database
Explain shows how MySQL uses indexes to process SELECT statements and join tables. Can help select better indexes and write more optimized query statements. Using the method, add explain to the SELECT statement. EXPLAIN Explanation of the column:
Explanation of the Explain column:
Table: Shows which table the data in this row is about
Type: This is an important column that shows what type the connection uses. The connection types from best to worst are const, EQ_REG, ref, range, Indexhe,
Using the method, add explain to the SELECT statement before you can:
Such as: Explain SELECT * FROM Test1
Explanation of the Explain column:
Table: Shows which table the data in this row is about
Type: This is an important column that shows what
The explain command in MySQL shows how MySQL uses the index to process SELECT statements and join tables. The information displayed by explain can help you select better indexes and write more optimized query statements.How to use 1.EXPLAIN:Add
Introduction:In the actual project development, because we do not know what is happening in the database when the actual query, database software is how to scan the table, how to use the index, so we can perceive onlyWhen the SQL statement runs, the
Explain shows how MySQL uses indexes to process SELECT statements and join tables. Can help select better indexes and write more optimized query statements.Using the method, add explain to the SELECT statement, such as:Explain select * from Statuses_
principles of MySQL index design 1. The index column of the search is not necessarily the column you want to select. In other words, the column that best fits the index is the column that appears in the WHERE clause, or the column specified in the
An index is a particular sort of algorithm for a particular MySQL field, such as a two-tree algorithm and a hashing algorithm, which is created by creating eigenvalues and then quickly finding them based on eigenvalues. And the most used, and is the
Explain shows how MySQL uses indexes to process SELECT statements and join tables. Can help select better indexes and write more optimized query statements.Using the method, add explain to the SELECT statement, such as:Explain select * from Statuses_
SQL Server Query Execution Plan AnalysisSource: http://www.sql-server-performance.com/tips/query_execution_plan_analysis_p1.aspxWhen you need to analyze the performance of a query, one of the best ways to see the execution plan for that query. The
Explain shows how MySQL uses indexes to process SELECT statements and join tables. Can help select better indexes and write more optimized query statements.Using the method, add explain to the SELECT statement:Such as:
Explain select
How to use: Add explain before the SELECT statement, such as:Explain select * from user where id = 1Results:+----+-------------+-------+-------+------------------+---------+---------+-------+------+-------+| ID | Select_type | Table | Type |
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.