免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
123下一页
最近访问板块 发新帖
查看: 8815 | 回复: 26
打印 上一主题 下一主题

帮我看一下,我的show global status 有什么问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-12-18 10:00 |只看该作者 |倒序浏览
10可用积分
需要 怎么样调整,现在的slow query 不少啊

mysql> show global status;
+-----------------------------------+------------+
| Variable_name                     | Value      |
+-----------------------------------+------------+
| Aborted_clients                   | 610        |
| Aborted_connects                  | 0          |
| Binlog_cache_disk_use             | 0          |
| Binlog_cache_use                  | 0          |
| Bytes_received                    | 4084206342 |
| Bytes_sent                        | 670517952  |
| Com_admin_commands                | 336        |
| Com_alter_db                      | 0          |
| Com_alter_table                   | 600        |
| Com_analyze                       | 0          |
| Com_backup_table                  | 0          |
| Com_begin                         | 0          |
| Com_change_db                     | 277        |
| Com_change_master                 | 0          |
| Com_check                         | 0          |
| Com_checksum                      | 0          |
| Com_commit                        | 38811      |
| Com_create_db                     | 0          |
| Com_create_function               | 0          |
| Com_create_index                  | 2          |
| Com_create_table                  | 300        |
| Com_dealloc_sql                   | 0          |
| Com_delete                        | 3154       |
| Com_delete_multi                  | 308        |
| Com_do                            | 0          |
| Com_drop_db                       | 0          |
| Com_drop_function                 | 0          |
| Com_drop_index                    | 1          |
| Com_drop_table                    | 300        |
| Com_drop_user                     | 0          |
| Com_execute_sql                   | 0          |
| Com_flush                         | 3          |
| Com_grant                         | 0          |
| Com_ha_close                      | 0          |
| Com_ha_open                       | 0          |
| Com_ha_read                       | 0          |
| Com_help                          | 0          |
| Com_insert                        | 1473283    |
| Com_insert_select                 | 241        |
| Com_kill                          | 0          |
| Com_load                          | 0          |
| Com_load_master_data              | 0          |
| Com_load_master_table             | 0          |
| Com_lock_tables                   | 417        |
| Com_optimize                      | 0          |
| Com_preload_keys                  | 0          |
| Com_prepare_sql                   | 0          |
| Com_purge                         | 0          |
| Com_purge_before_date             | 0          |
| Com_rename_table                  | 0          |
| Com_repair                        | 0          |
| Com_replace                       | 0          |
| Com_replace_select                | 0          |
| Com_reset                         | 0          |
| Com_restore_table                 | 0          |
| Com_revoke                        | 0          |
| Com_revoke_all                    | 0          |
| Com_rollback                      | 113        |
| Com_savepoint                     | 0          |
| Com_select                        | 7251068    |
| Com_set_option                    | 958234     |
| Com_show_binlog_events            | 0          |
| Com_show_binlogs                  | 1          |
| Com_show_charsets                 | 35         |
| Com_show_collations               | 680        |
| Com_show_column_types             | 0          |
| Com_show_create_db                | 0          |
| Com_show_create_table             | 1639       |
| Com_show_databases                | 96         |
| Com_show_errors                   | 0          |
| Com_show_fields                   | 2473       |
| Com_show_grants                   | 0          |
| Com_show_innodb_status            | 0          |
| Com_show_keys                     | 388        |
| Com_show_logs                     | 0          |
| Com_show_master_status            | 0          |
| Com_show_ndb_status               | 0          |
| Com_show_new_master               | 0          |
| Com_show_open_tables              | 0          |
| Com_show_privileges               | 0          |
| Com_show_processlist              | 340        |
| Com_show_slave_hosts              | 0          |
| Com_show_slave_status             | 0          |
| Com_show_status                   | 3050       |
| Com_show_storage_engines          | 0          |
| Com_show_tables                   | 224        |
| Com_show_triggers                 | 1637       |
| Com_show_variables                | 699        |
| Com_show_warnings                 | 0          |
| Com_slave_start                   | 0          |
| Com_slave_stop                    | 0          |
| Com_stmt_close                    | 897837     |
| Com_stmt_execute                  | 912317     |
| Com_stmt_fetch                    | 0          |
| Com_stmt_prepare                  | 897837     |
| Com_stmt_reset                    | 0          |
| Com_stmt_send_long_data           | 0          |
| Com_truncate                      | 0          |
| Com_unlock_tables                 | 417        |
| Com_update                        | 384930     |
| Com_update_multi                  | 0          |
| Com_xa_commit                     | 0          |
| Com_xa_end                        | 0          |
| Com_xa_prepare                    | 0          |
| Com_xa_recover                    | 0          |
| Com_xa_rollback                   | 0          |
| Com_xa_start                      | 0          |
| Compression                       | OFF        |
| Connections                       | 797270     |
| Created_tmp_disk_tables           | 3486       |
| Created_tmp_files                 | 9          |
| Created_tmp_tables                | 138203     |
| Delayed_errors                    | 0          |
| Delayed_insert_threads            | 0          |
| Delayed_writes                    | 0          |
| Flush_commands                    | 1          |
| Handler_commit                    | 46311      |
| Handler_delete                    | 285850     |
| Handler_discover                  | 0          |
| Handler_prepare                   | 0          |
| Handler_read_first                | 67265      |
| Handler_read_key                  | 26894285   |
| Handler_read_next                 | 398816483  |
| Handler_read_prev                 | 111644361  |
| Handler_read_rnd                  | 530421     |
| Handler_read_rnd_next             | 70476818   |
| Handler_rollback                  | 10         |
| Handler_savepoint                 | 0          |
| Handler_savepoint_rollback        | 0          |
| Handler_update                    | 828571     |
| Handler_write                     | 15495286   |
| Innodb_buffer_pool_pages_data     | 497        |
| Innodb_buffer_pool_pages_dirty    | 0          |
| Innodb_buffer_pool_pages_flushed  | 11839      |
| Innodb_buffer_pool_pages_free     | 1          |
| Innodb_buffer_pool_pages_latched  | 0          |
| Innodb_buffer_pool_pages_misc     | 14         |
| Innodb_buffer_pool_pages_total    | 512        |
| Innodb_buffer_pool_read_ahead_rnd | 2073       |
| Innodb_buffer_pool_read_ahead_seq | 3811       |
| Innodb_buffer_pool_read_requests  | 102596254  |
| Innodb_buffer_pool_reads          | 94701      |
| Innodb_buffer_pool_wait_free      | 0          |
| Innodb_buffer_pool_write_requests | 134100     |
| Innodb_data_fsyncs                | 4873       |
| Innodb_data_pending_fsyncs        | 0          |
| Innodb_data_pending_reads         | 0          |
| Innodb_data_pending_writes        | 0          |
| Innodb_data_read                  | 2345242624 |
| Innodb_data_reads                 | 111045     |
| Innodb_data_writes                | 13768      |
| Innodb_data_written               | 392348672  |
| Innodb_dblwr_pages_written        | 11839      |
| Innodb_dblwr_writes               | 1030       |
| Innodb_log_waits                  | 0          |
| Innodb_log_write_requests         | 7121       |
| Innodb_log_writes                 | 1922       |
| Innodb_os_log_fsyncs              | 2710       |
| Innodb_os_log_pending_fsyncs      | 0          |
| Innodb_os_log_pending_writes      | 0          |
| Innodb_os_log_written             | 4004352    |
| Innodb_page_size                  | 16384      |
| Innodb_pages_created              | 93         |
| Innodb_pages_read                 | 142895     |
| Innodb_pages_written              | 11839      |
| Innodb_row_lock_current_waits     | 0          |
| Innodb_row_lock_time              | 0          |
| Innodb_row_lock_time_avg          | 0          |
| Innodb_row_lock_time_max          | 0          |
| Innodb_row_lock_waits             | 0          |
| Innodb_rows_deleted               | 2567       |
| Innodb_rows_inserted              | 7671       |
| Innodb_rows_read                  | 105415964  |
| Innodb_rows_updated               | 1167       |
| Key_blocks_not_flushed            | 4294967291 |
| Key_blocks_unused                 | 447202     |
| Key_blocks_used                   | 463920     |
| Key_read_requests                 | 100174317  |
| Key_reads                         | 1272938    |
| Key_write_requests                | 16085485   |
| Key_writes                        | 3340404    |
| Last_query_cost                   | 0.000000   |
| Max_used_connections              | 101        |
| Not_flushed_delayed_rows          | 0          |
| Open_files                        | 22         |
| Open_streams                      | 0          |
| Open_tables                       | 64         |
| Opened_tables                     | 6014       |
| Qcache_free_blocks                | 0          |
| Qcache_free_memory                | 0          |
| Qcache_hits                       | 0          |
| Qcache_inserts                    | 0          |
| Qcache_lowmem_prunes              | 0          |
| Qcache_not_cached                 | 0          |
| Qcache_queries_in_cache           | 0          |
| Qcache_total_blocks               | 0          |
| Questions                         | 12717693   |
| Rpl_status                        | NULL       |
| Select_full_join                  | 294        |
| Select_full_range_join            | 0          |
| Select_range                      | 36644      |
| Select_range_check                | 10969      |
| Select_scan                       | 24964      |
| Slave_open_temp_tables            | 0          |
| Slave_retried_transactions        | 0          |
| Slave_running                     | OFF        |
| Slow_launch_threads               | 0          |
| Slow_queries                      | 276889     |
| Sort_merge_passes                 | 6          |
| Sort_range                        | 2543       |
| Sort_rows                         | 109214     |
| Sort_scan                         | 1256       |
| Ssl_accept_renegotiates           | 0          |
| Ssl_accepts                       | 0          |
| Ssl_callback_cache_hits           | 0          |
| Ssl_cipher                        |            |
| Ssl_cipher_list                   |            |
| Ssl_client_connects               | 0          |
| Ssl_connect_renegotiates          | 0          |
| Ssl_ctx_verify_depth              | 0          |
| Ssl_ctx_verify_mode               | 0          |
| Ssl_default_timeout               | 0          |
| Ssl_finished_accepts              | 0          |
| Ssl_finished_connects             | 0          |
| Ssl_session_cache_hits            | 0          |
| Ssl_session_cache_misses          | 0          |
| Ssl_session_cache_mode            | NONE       |
| Ssl_session_cache_overflows       | 0          |
| Ssl_session_cache_size            | 0          |
| Ssl_session_cache_timeouts        | 0          |
| Ssl_sessions_reused               | 0          |
| Ssl_used_session_cache_entries    | 0          |
| Ssl_verify_depth                  | 0          |
| Ssl_verify_mode                   | 0          |
| Ssl_version                       |            |
| Table_locks_immediate             | 2428657    |
| Table_locks_waited                | 2035       |
| Tc_log_max_pages_used             | 0          |
| Tc_log_page_size                  | 0          |
| Tc_log_page_waits                 | 0          |
| Threads_cached                    | 0          |
| Threads_connected                 | 6          |
| Threads_created                   | 797269     |
| Threads_running                   | 1          |
| Uptime                            | 1724087    |
+-----------------------------------+------------+

论坛徽章:
0
2 [报告]
发表于 2009-12-18 10:05 |只看该作者
Threads_created                   | 797269

线程太多了? 很多没释放出来?

论坛徽章:
0
3 [报告]
发表于 2009-12-18 10:18 |只看该作者
原帖由 mysqlkiki 于 2009-12-18 10:05 发表
Threads_created                   | 797269

线程太多了? 很多没释放出来?


Threads_cached                    | 0   
没有线程 cache 导致 创建线程太多?

论坛徽章:
0
4 [报告]
发表于 2009-12-18 10:43 |只看该作者
贴一下show processlist结果看看,

论坛徽章:
0
5 [报告]
发表于 2009-12-18 10:44 |只看该作者
增加thread_cache吧!

论坛徽章:
9
每日论坛发贴之星
日期:2016-01-04 06:20:00数据库技术版块每日发帖之星
日期:2016-01-04 06:20:00每日论坛发贴之星
日期:2016-01-04 06:20:00数据库技术版块每日发帖之星
日期:2016-01-04 06:20:00IT运维版块每日发帖之星
日期:2016-01-04 06:20:00IT运维版块每日发帖之星
日期:2016-01-04 06:20:00综合交流区版块每日发帖之星
日期:2016-01-04 06:20:00综合交流区版块每日发帖之星
日期:2016-01-04 06:20:00数据库技术版块每周发帖之星
日期:2016-03-07 16:30:25
6 [报告]
发表于 2009-12-18 10:54 |只看该作者
slow query的话还是应该先从语句入手。。。
别急着调参数。

论坛徽章:
0
7 [报告]
发表于 2009-12-18 11:09 |只看该作者
原帖由 cenalulu 于 2009-12-18 10:54 发表
slow query的话还是应该先从语句入手。。。
别急着调参数。


用mysqlsla 查看 主要 是这条sql语句很厉害,有75.86%
以前没调整索引大小的时候这个比例是88%,现在好像降下来一点了

Count         : 14.37k  (75.86%)
Time          : 967006 s total, 67.302756 s avg, 2 s to 22138 s max  (54.62%)
  95% of Time : 40419 s total, 2.961316 s avg, 2 s to 7 s max
Lock Time (s) : 531915 s total, 37.02081 s avg, 0 to 20884 s max  (40.59%)
  95% of Lock : 0 total, 0 avg, 0 to 0 max
Rows sent     : 17 avg, 0 to 20 max  (83.54%)
Rows examined : 3.60k avg, 12 to 4.62M max  (68.03%)
Database      : tb
Users         :
        root@localhost  : 100.00% (1436 of query, 93.50% (17709) of all users

Query abstract:
SELECT iid,title,pic_path,price FROM tb_goods WHERE nick='S' ORDER BY lmsn DESC LIMIT N,N;

explain Query :
mysql> explain select iid,title,pic_path,price from tb_goods where nick='vivizone' order by lmsn desc limit 480,20 \G;
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: tb_goods
         type: ref
possible_keys: nickgood
          key: nickgood
      key_len: 32
          ref: const
         rows: 806
        Extra: Using where
1 row in set (0.00 sec)

论坛徽章:
9
每日论坛发贴之星
日期:2016-01-04 06:20:00数据库技术版块每日发帖之星
日期:2016-01-04 06:20:00每日论坛发贴之星
日期:2016-01-04 06:20:00数据库技术版块每日发帖之星
日期:2016-01-04 06:20:00IT运维版块每日发帖之星
日期:2016-01-04 06:20:00IT运维版块每日发帖之星
日期:2016-01-04 06:20:00综合交流区版块每日发帖之星
日期:2016-01-04 06:20:00综合交流区版块每日发帖之星
日期:2016-01-04 06:20:00数据库技术版块每周发帖之星
日期:2016-03-07 16:30:25
8 [报告]
发表于 2009-12-18 11:13 |只看该作者
nickgood是一个nick上的单列索引吧?

考虑建一个 nick+lmxn的符合索引吧。
另外慢的原因跟你的limit 480,20有关系。
页面分页上可以考虑做相关优化

论坛徽章:
0
9 [报告]
发表于 2009-12-18 11:17 |只看该作者
原帖由 cenalulu 于 2009-12-18 11:13 发表
nickgood是一个nick上的单列索引吧?

考虑建一个 nick+lmxn的符合索引吧。
另外慢的原因跟你的limit 480,20有关系。
页面分页上可以考虑做相关优化


nickgood 是联合索引

| tb_goods |          1 | nickgood  |            1 | nick        | A         |       53944 |       10 | NULL   |      | BTREE      | NULL    |
| tb_goods |          1 | nickgood  |            2 | lmsn        | A         |      327037 |     NULL | NULL   |      | BTREE      | NULL    |
+----------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+

limit 的问题 ,可能影响到了效率,那么limit如何优化呢

论坛徽章:
0
10 [报告]
发表于 2009-12-18 11:33 |只看该作者
顶上来
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP