浅谈 My sql 性能调优

Embed Size (px)

Citation preview

1

2011/12/91 MySQL

(sky000) Oracle ACE(Expertise: MySQL) @

Bloghttp://isky000.comTwitter@sky000Weibo@

About me

2011/12/92 MySQL

2011/12/93 MySQL IO (IOPS/)CPUDRAMNetwork(IOPS/) OLTPiops OLAP> 90% IO2TBLinuxGX86 Nehalem IBM Power 4 PC Server 32

2011/12/94 MySQL

2011/12/95 MySQL

ParamsEngineSchemaIndexSQL

2011/12/96 MySQL IOMySQLSQL

~ Balance Tree

HDD: ~150 iops, < 200MBSSD: 10x ~ 1000x, < 400MB

SQL+Storage Engine

explainDocs

2011/12/97 MySQL

ParamsCache/BufferConnction

query_cacheSQLbinlog_cache_sizebinlogtable_cacheMyISAMthread_cachekey_buffer_sizeMyISAMMyISAMinnodb_db_buffer_pool_sizeInnoDBinnodb_log_buff_sizeInnoDBinnodb_max_dirty_pages_pctInnoDB Bufferhttp://isky000.com/database/mysql-perfornamce-tuning-cache-parameter

max_connectionsmax_connect_errorsback_logskip-name-resolve DNS interactive_timeoutwait_timeoutIO

innodb_flush_methodinnodblinuxinnodb_flush_log_at_trx_commitinnodbinnodb_file_per_tablesync_binlogbinlog

2011/12/98 MySQL

ParamsCache/Buffer

query_cachebinlog_cache_sizetable_cachethread_cachekey_buffer_sizeinnodb_db_buffer_pool_sizeinnodb_log_buff_sizeinnodb_max_dirty_pages_pcthttp://isky000.com/database/mysql-perfornamce-tuning-cache-parameterConnction

max_connectionsmax_connect_errorsback_logback logskip-name-resolve DNS interactive_timeoutwait_timeoutIO

innodb_flush_methodinnodb_flush_log_at_trx_commit1innodb_file_per_tablesync_binlog

2011/12/99 MySQL

ParamsCache/Buffer

query_cache256MBInnoDBbinlog_cache_size2MB~4MB< 32MBtable_cache1024thread_cache1024< max_connectioskey_buffer_sizeMyISAM 16MBMYIinnodb_db_buffer_pool_sizeInnoDBinnodb_log_buff_size4MB~8MB< 32MBinnodb_max_dirty_pages_pct1000back_log100< OSskip-name-resolveIPinteractive_timeoutwait_timeout8640024IO

innodb_flush_methodO_DIRECT(Linux)innodb_flush_log_at_trx_commit210innodb_file_per_tablesync_binlog4~80

2011/12/910 MySQL

Storage EngineMyISAMInnoDB

MyISAM insert delay select insertselect Query Cache Query Cache

aotucommit innodb_flush_log_at_trx_commit

2011/12/911 MySQL

Storage EngineMyISAMInnoDB

key_buffer MyISAM MyISAM MyISAM InnoDB MyISAM count

Innodb_buffer_pool

2011/12/912 MySQL

Storage EngineMyISAMInnoDB

2011/12/913 MySQL

Schame

lob

http://isky000.com/database/mysql-perfornamce-tuning-schema

2011/12/914 MySQL

Schame

INT(1) 1MySQL

Server

select

http://isky000.com/database/mysql-perfornamce-tuning-schema

2011/12/915 MySQL

Schame

DOUBLE TINYINT / INT / BIGINTTEXTVARCHARTIMESTAMPDATEDATETIME LOB ENUM & SET

latin1 UNICODE

Join 2http://isky000.com/database/mysql-perfornamce-tuning-schema

2011/12/916 MySQL

Index

http://isky000.com/database/mysql-performance-tuning-index

2011/12/917 MySQL

Index

Where SQL

where SQL

http://isky000.com/database/mysql-performance-tuning-index

2011/12/918 MySQL

Index

NULLIO

SQL SQL

(8)

()/()http://isky000.com/database/mysql-performance-tuning-index

2011/12/919 MySQL

SQLhttp://isky000.com/database/mysql-performance-tuning-sql

SQL MySQL Bug

2011/12/920 MySQL

SQLhttp://isky000.com/database/mysql-performance-tuning-sql

count(1)count(primary_key) count(*)count(column) count(*) select a,b from select a,b,c from order by filesort

2011/12/921 MySQL

SQLhttp://isky000.com/database/mysql-performance-tuning-sql

SQLSQL select * join or in union(union all) union all unionJoin SQLSQLSQL explain

2011/12/922 MySQL OSMySQLApptopvmstatiostatshow statuslatencytps

2011/12/923 MySQL ThanksQ & Ahttp://isky000.comTwitter@sky000Weibo@