Mysql executes multi-table queries, big data, and SQL statements. Assume that two tables are & nbsp; A & nbsp; B. The two tables have the same structure. Now we need to retrieve all the fields in Table A and the set and rutime fields in Table B. The IDs of the two tables are the same. & Nbsp; because mysql executes multi-table queries, big data, and how to write SQL statements.
Assume that two tables are a B. The two tables have the same structure. Now we need to retrieve all the fields in Table A and the set and rutime fields in Table B. The IDs of the two tables are the same.
Because the data volume is large, the two tables are around, and there may be multiple such large tables later.
In phpmyadmin
Select * from A as a, B as B where a. haoma = B. haoma
During the test, the system has run and died. Which of the following statements can I share with you:
------ Solution --------------------
Is haoma a primary key? If not, create an index.
------ Solution --------------------
Select * from A as a, B as B where a. haoma = B. haoma
As long as an index is built on haoma, querying is just an instant
However, the output takes some time!
Do you print out all the 1 million records? Apparently, my head is faulty.
------ Solution --------------------
Direct
Insert into c (......)
Select ecs_ershi. *, ecs_erjiu.set
From ecs_ershi inner join ecs_erjiu on ecs_ershi.haoma = ecs_erjiu.haoma
Limit 0, 29
You can,
Do not output...
------ Solution --------------------
Reference:
Select * from A as a, B as B where a. haoma = B. haoma
As long as an index is built on haoma, querying is just an instant
However, the output takes some time!
Do you print out all the 1 million records? Apparently, my head is faulty.
I am here to get points.
------ Solution --------------------
This should reflect the role of the index. Querying millions of records is slow.
------ Solution --------------------
1. as mentioned above, create a valid index
2. create a sub-table if the data size increases later
3. the table structure involves the separation of long characters into the new table
4. query using stored procedures
------ Solution --------------------
Desc select * from A as a, B as B where a. haoma = B. haoma adds an index to the table quickly. if you have A where condition query, you can add a full-text index.