我们有一个使用MyIsam表运行MySQL 5.0.45的大小为150 GB的数据库,有一些大表的大小超过5 GB,索引为2GB.

服务器配置为:

8GB

双核3.2GHz –启用超线程

一次突袭5-SCSI

1GB网卡

64位操作系统

这是我们的my.cnf文件:

[client]

port = 3306

socket = /var/lib/mysql/mysql.sock

[mysqld]

log=/var/log/mysqld.log

log-slow-queries=/var/log/mysqld-slow.log

set-variable=long_query_time=2

set-variable=sql_mode=ANSI_QUOTES

port = 3306

socket = /var/lib/mysql/mysql.sock

skip-locking

max_connections = 100

key_buffer = 384M

max_allowed_packet = 16M

table_cache = 512

sort_buffer_size = 2M

read_buffer_size = 2M

read_rnd_buffer_size = 8M

myisam_sort_buffer_size = 64M

thread_cache = 8

query_cache_size = 32M

thread_concurrency = 3

[isamchk]

key_buffer = 256M

sort_buffer_size = 256M

read_buffer = 2M

write_buffer = 2M

[myisamchk]

key_buffer = 256M

sort_buffer_size = 256M

read_buffer = 2M

write_buffer = 2M

[mysqldump]

quick

max_allowed_packet = 16M

[mysql]

no-auto-rehash

[isamchk]

key_buffer = 256M

sort_buffer_size = 256M

read_buffer = 2M

write_buffer = 2M

[myisamchk]

key_buffer = 256M

sort_buffer_size = 256M

read_buffer = 2M

write_buffer = 2M

非常感谢您提出改善查询性能的建议(读80%/写20%)