来自中等表的非常简单的查询挂起“发送数据”

时间:2014-08-13 20:32:13

标签: mysql sql performance

我有一个非常简单的查询

select count(*) from user_access where user_name='mike'

在桌子上

+-----------+-------------+------+-----+-------------------+-----------------------------+
| Field     | Type        | Null | Key | Default           | Extra                       |
+-----------+-------------+------+-----+-------------------+-----------------------------+
| user_name | varchar(32) | NO   | PRI | NULL              |                             |
| sample_id | int(11)     | NO   | PRI | 0                 |                             |
| updated   | timestamp   | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
+-----------+-------------+------+-----+-------------------+-----------------------------+

我已经通过网络和主机本身尝试了这种方式,无论是哪种方式都挂起

| 14051 |  | localhost                     | nir  | Query   |   677 | Sending data | select count(*) from user_access where user_name='mike'   

以下是缓冲区列表&缓存和这样

+---------------------------------------------------+----------------------+
| Variable_name                                     | Value                |
+---------------------------------------------------+----------------------+
| binlog_cache_size                                 | 32768                |
| binlog_stmt_cache_size                            | 32768                |
| bulk_insert_buffer_size                           | 8388608              |
| delayed_queue_size                                | 1000                 |
| innodb_additional_mem_pool_size                   | 8388608              |
| innodb_buffer_pool_size                           | 134217728            |
| innodb_log_buffer_size                            | 8388608              |
| innodb_log_file_size                              | 5242880              |
| innodb_purge_batch_size                           | 20                   |
| join_buffer_size                                  | 131072               |
| key_buffer_size                                   | 16777216             |
| key_cache_block_size                              | 1024                 |
| large_page_size                                   | 0                    |
| max_binlog_cache_size                             | 18446744073709547520 |
| max_binlog_size                                   | 104857600            |
| max_binlog_stmt_cache_size                        | 18446744073709547520 |
| max_heap_table_size                               | 16777216             |
| max_join_size                                     | 18446744073709551615 |
| max_long_data_size                                | 67108864             |
| max_relay_log_size                                | 0                    |
| metadata_locks_cache_size                         | 1024                 |
| myisam_data_pointer_size                          | 6                    |
| myisam_max_sort_file_size                         | 9223372036853727232  |
| myisam_mmap_size                                  | 18446744073709551615 |
| myisam_sort_buffer_size                           | 8388608              |
| performance_schema_events_waits_history_long_size | 10000                |
| performance_schema_events_waits_history_size      | 10                   |
| preload_buffer_size                               | 32768                |
| profiling_history_size                            | 15                   |
| query_alloc_block_size                            | 8192                 |
| query_cache_size                                  | 16777216             |
| query_prealloc_size                               | 8192                 |
| range_alloc_block_size                            | 4096                 |
| read_buffer_size                                  | 131072               |
| read_rnd_buffer_size                              | 262144               |
| sort_buffer_size                                  | 2097152              |
| sql_max_join_size                                 | 18446744073709551615 |
| thread_cache_size                                 | 8                    |
| tmp_table_size                                    | 16777216             |
| transaction_alloc_block_size                      | 8192                 |
| transaction_prealloc_size                         | 4096                 |
+---------------------------------------------------+----------------------+     

如果有其他人希望看到的数据,我会得到它。

有一个非常香草的查询。有人可以建议找个问题的地方吗?

EXPLAIN的输出是

+----+-------------+-------------+-------+---------------+---------+---------+--‌​----+-------+--------------------------+ 
| id | select_type | table       | type  | possible_keys | key     | key_len | ref  | rows  | Extra                    | +----+-------------+-------------+-------+---------------+---------+---------+--‌​----+-------+--------------------------+ 
| 1  | SIMPLE      | user_access | index | NULL          | PRIMARY | 38      | NULL | 57224 | Using where; Using index |

0 个答案:

没有答案