背景描述
# Time: 2019-01-24T00:08:14.705724+08:00
# User@Host: **[**] @ [**] Id: **
# Schema: sentrymeta Last_errno: 0 Killed: 0
# Query_time: 0.315758 Lock_time: 0.001693 Rows_sent: 9664 Rows_examined: 36413 Rows_affected: 0
# Bytes_sent: 1616970 Tmp_tables: 1 Tmp_disk_tables: 1 Tmp_table_sizes: 16384
# QC_Hit: No Full_scan: No Full_join: No Tmp_table: Yes Tmp_table_on_disk: Yes
# Filesort: No Filesort_on_disk: No Merge_passes: 0
# InnoDB_IO_r_ops: 0 InnoDB_IO_r_bytes: 0 InnoDB_IO_r_wait: 0.000000
# InnoDB_rec_lock_wait: 0.000000 InnoDB_queue_wait: 0.000000
# InnoDB_pages_distinct: 1085
total used free shared buffers cached
Mem:
-/+ buffers/cache:
Swap:
root@(none)04:33:02>select version();
+---------------+
| version() |
+---------------+
| 5.7.19-17-log |
+---------------+
1 row in set (0.00 sec) root@(none)04:33:07>show variables like '%table_size%';
+---------------------+-----------+
| Variable_name | Value |
+---------------------+-----------+
| max_heap_table_size | 134217728 |
| tmp_table_size | 16777216 |
+---------------------+-----------+
2 rows in set (0.00 sec)
问题分析
Q1:为什么会产生临时表?
这个不多说,SQL写的惹不起,反正就是半个小时看不懂的那种,就是一眼就知道一定会产生临时表的