mysql insert 效率优化点

show global status like ‘%locks%’;

Key_blocks_not_flushed 0
Key_blocks_unused 5939
Key_blocks_used 7457
Qcache_free_blocks 0
Qcache_total_blocks 0
Table_locks_immediate 16264295
Table_locks_waited 1

查看concurrent_insert:

SHOW GLOBAL VARIABLES LIKE ‘%concurrent_insert%’;

查看mysql版本:

select version()

show status like ‘%thread%’;

Delayed_insert_threads 0
Slow_launch_threads 0
Threads_cached 0
Threads_connected 4
Threads_created 354512
Threads_running 3

Threads_created太高,要优化thread_cache_size,可以设置为8,16,64等,要看mysql服务器内存情况:
set global thread_cache_size = 8

插入方面的效率,可以看:

SHOW GLOBAL VARIABLES LIKE ‘%max_delayed_threads%’;

max_delayed_threads 20

你可能感兴趣的:(mysql,mysql)