OS: AS4U6, 2.6.9-67.0.15.ELsmp, 16G Ram, MD3000阵列, xfs文件系统 MySQL 5.1.26 - percona(innodb plugin, innodb stat, user stat, msl, show patch, acc-pslist 补丁)
default_table_type = innodb log_slow_queries long_query_time = 0.001 log_slow_verbosity=query_plan,innodb innodb_data_file_path = ibdata1:1024M:autoextend innodb_log_file_size = 400M innodb_log_files_in_group = 3 innodb_file_per_table innodb_file_format="Barracuda"
innodb_buffer_pool_size = 8388608 join_buffer_size = 131072 key_buffer_size = 8388600 max_heap_table_size = 16777216 query_cache_size = 0 read_buffer_size = 131072 read_rnd_buffer_size = 262144 sort_buffer_size = 2097144 tmp_table_size = 16777216
EXPLAIN SELECT SQL_NO_CACHE * FROM T1 WHERE ID<10000 ORDER BY ID DESC; +----+-------------+-------+-------+---------------+---------+---------+------+-------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+-------+---------------+---------+---------+------+-------+-------------+ | 1 | SIMPLE | T1 | range | PRIMARY | PRIMARY | 8 | NULL | 14872 | Using where | +----+-------------+-------+-------+---------------+---------+---------+------+-------+-------------+ # Query_time: 0.207893 Lock_time: 0.000056 Rows_sent: 9999 Rows_examined: 9999 # QC_Hit: No Full_scan: No Full_join: No Tmp_table: No Tmp_table_on_disk: No # Filesort: No Filesort_on_disk: No Merge_passes: 0 # InnoDB_IO_r_ops: 91 InnoDB_IO_r_bytes: 1490944 InnoDB_IO_r_wait: 0.083391 # InnoDB_rec_lock_wait: 0.000000 InnoDB_queue_wait: 0.000000 # InnoDB_pages_distinct: 93 SELECT SQL_NO_CACHE * FROM T1 WHERE ID<10000 ORDER BY ID DESC;
EXPLAIN SELECT SQL_NO_CACHE * FROM T1 WHERE ID<10000 ORDER BY C1 DESC; +----+-------------+-------+-------+---------------+---------+---------+------+-------+-----------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+-------+---------------+---------+---------+------+-------+-----------------------------+ | 1 | SIMPLE | T1 | range | PRIMARY | PRIMARY | 8 | NULL | 14872 | Using where; Using filesort | +----+-------------+-------+-------+---------------+---------+---------+------+-------+-----------------------------+ # Query_time: 0.120879 Lock_time: 0.000023 Rows_sent: 9999 Rows_examined: 19998 # QC_Hit: No Full_scan: No Full_join: No Tmp_table: No Tmp_table_on_disk: No # Filesort: Yes Filesort_on_disk: Yes Merge_passes: 1 # 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: 93 SELECT SQL_NO_CACHE * FROM T1 WHERE ID<10000 ORDER BY C1 DESC;
set session sort_buffer_size = 1024 * 1024 * 5;
# Query_time: 0.080727 Lock_time: 0.000030 Rows_sent: 9999 Rows_examined: 19998 # QC_Hit: No Full_scan: No Full_join: No Tmp_table: No Tmp_table_on_disk: No # Filesort: Yes 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: 93 SELECT SQL_NO_CACHE * FROM T1 WHERE ID<10000 ORDER BY C1 DESC;
EXPLAIN SELECT SQL_NO_CACHE * FROM T1 AS T1 WHERE ID<10000 ORDER BY C1 DESC; +----+-------------+-------+-------+---------------+---------+---------+------+-------+-----------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+-------+---------------+---------+---------+------+-------+-----------------------------+ | 1 | SIMPLE | T1 | range | PRIMARY | PRIMARY | 8 | NULL | 14872 | Using where; Using filesort | +----+-------------+-------+-------+---------------+---------+---------+------+-------+-----------------------------+ # Query_time: 0.103654 Lock_time: 0.000045 Rows_sent: 9999 Rows_examined: 19998 # QC_Hit: No Full_scan: No Full_join: No Tmp_table: No Tmp_table_on_disk: No # Filesort: Yes Filesort_on_disk: Yes Merge_passes: 1 # 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: 93 SELECT SQL_NO_CACHE * FROM T1 AS T1 WHERE ID<10000 ORDER BY C1 DESC;
本文出自 “爱MySQL” 博客,转载请与作者联系!