A bad SQL statement colleague sent an SQL statement, saying that this SQL statement occupies a large amount of server disk space during execution, which is about 10 Gb, and the efficiency is ultra-slow SELECT MIN (order_id ), MAX (order_id) FROM (select *, date (order_creation_date) create_date from orders where (1 = 1) AS t1 1 is a bad SQL statement, select * from table_name is definitely not allowed. 2 at the beginning, I didn't understand what this SQL is for. Why should I query data from this table? Select *, date (order_creation_date) create_date from orders where (1 = 1) as a nested table. 3. Why does a temporary table exist in the middle of the disk space during the query process, so the memory cannot store so much data and the data is copied to the disk, generally, a similar # SQL _ *** is generated under/tmp _***. MYD, # SQL _***. A file like MYI is actually a myisam table. This process wastes time and affects performance. Consult a colleague to query the maximum and minimum values of order_id. After reading the structure of the orders table, the order_id of orders is the auto-incrementing primary key, which is simple. Rewrite the following select max (order_id) and min (order_id) from orders order_id is the auto-incrementing primary key, the index has been created and is ordered. Therefore, the maximum and minimum values of the max min composite function are very fast.