回忆未来的张宴推荐了这本书,并且在他的博客上提供了下载的链接,链接是新浪的爱问:点此下载《High Performance MySQL Second Edition》PDF电子版,并且博客上还有详细介绍:
XML/HTML代码
- High Performance MySQL Second Edition
- 作者: Baron Schwartz / Peter Zaitsev / Vadim Tkachenko / Jeremy Zawodny / Arjen Lentz / Derek Balling
-
- 副标题: Optimization, Backups, Replication, and More
- ISBN: 9780596101718
- 页数: 708
- 定价: USD 49.99
- 出版社: O'Reilly Media, Inc.
- 装帧: Paperback
- 出版年: 2008-06-18
-
- High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity.
-
- High Performance MySQL teaches you advanced techniques in depth so you can bring out MySQL's full power. Learn how to design schemas, indexes, queries and advanced MySQL features for maximum performance, and get detailed guidance for tuning your MySQL server, operating system, and hardware to their fullest potential. You'll also learn practical, safe, high-performance ways to scale your applications with replication, load balancing, high availability, and failover.
-
- This second edition is completely revised and greatly expanded, with deeper coverage in all areas. Major additions include:
- * Emphasis throughout on both performance and reliability
- * Thorough coverage of storage engines, including in-depth tuning and optimizations for the InnoDB storage engine
- * Effects of new features in MySQL 5.0 and 5.1, including stored procedures, partitioned databases, triggers, and views
- * A detailed discussion on how to build very large, highly scalable systems with MySQL
- * New options for backups and replication
- * Optimization of advanced querying features, such as full-text searches
- * Four new appendices
- The book also includes chapters on benchmarking, profiling, backups, security, and tools and techniques to help you measure, monitor, and manage your MySQL installations.
为此,张宴还提供了一张图片:

整篇博客我作了一下整理和排序,想看原文的,请到:http://blog.s135.com/read.php?381,因为在这个页面上张宴采用了划词翻译,如果有看不懂英文的话,选中一下就会自动翻译了。。我没有提供。也不想再插入一些代码。呵呵
为了方便大家,我也上传了这个文件,大家可以点击下载:high.performance.mysql_second.edition.zip
mysql数据库也像ORACLE数据库一样,可以动态的修改参数,可以修改会话级变量只对当前会话产生影响;也可以修改全局变量,对所有新连接的会话都产生影响。
修改会话级变量
用show variables 命令查看当前参数的值,like 'pattern'用于模式匹配,查找指定的参数
mysql> show variables like '%sort_buffer_size%';
+---------------------------+------------+
| Variable_name | Value |
+---------------------------+------------+
| sort_buffer_size | 6291448 |
+---------------------------+------------+
1 rows in set (0.00 sec)
用set SESSION命令设置会话级变量的新值
mysql> set SESSION sort_buffer_size=7000000;
Query OK, 0 rows affected (0.00 sec)
--修改会话级变量对当前会话来说立刻生效
mysql> show variables like '%sort_buffer_size%';
+---------------------------+------------+
| Variable_name | Value |
+---------------------------+------------+
| sort_buffer_size | 7000000 |
+---------------------------+------------+
1 rows in set (0.00 sec)
mysql> exit
Bye
退出重新连接后,此参数恢复原值
[root@devdbc_stb root]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 40 to server version: 5.0.37-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show variables like '%sort_buffer_size%';
+---------------------------+------------+
| Variable_name | Value |
+---------------------------+------------+
| sort_buffer_size | 6291448 |
+---------------------------+------------+
1 rows in set (0.00 sec)
修改全局变量
[root@devdbc_stb root]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 40 to server version: 5.0.37-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show variables like '%sort_buffer_size%';
+---------------------------+------------+
| Variable_name | Value |
+---------------------------+------------+
| sort_buffer_size | 6291448 |
+---------------------------+------------+
1 rows in set (0.00 sec)
用set GLOBAL 命令设置全局变量
mysql> set GLOBAL sort_buffer_size = 7000000;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like '%sort_buffer_size%';
+---------------------------+------------+
| Variable_name | Value |
+---------------------------+------------+
| sort_buffer_size | 6291448 |
+---------------------------+------------+
1 rows in set (0.00 sec)
当前此参数的值并不发生变化,先退出,然后重新连进去
mysql> exit
Bye
[root@devdbc_stb root]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 41 to server version: 5.0.37-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show variables like '%sort_buffer_size%';
+---------------------------+------------+
| Variable_name | Value |
+---------------------------+------------+
| sort_buffer_size | 7000000 |
+---------------------------+------------+
1 rows in set (0.00 sec)
新的参数值生效