出版時間:2012-6 出版社:東南大學出版社 作者:(美)施瓦茲,(美)扎伊采夫,(美)特卡申科 著 頁數(shù):793 字數(shù):1013000
Tag標簽:無
前言
We wrote this book to serve the needs of not just the MySQL application developer but also the MySQL database administrator. We assume that you are already relatively experienced with MySQL. We also assume some experience with general system ad ministration, networking, and Unix-like operating systems. The second edition of this book presented a lot of information to readers, but no book can provide complete coverage of a topic. Between the second and third editions, we took notes, on literally thousands of interesting problems we'd solved or seen others solve. When we started to outline the third edition, it became clear that not only would full coverage of these topics require three to five thousand pages, but the book still wouldn't be complete. After reflecting on this problem, we realized that the second edition's emphasis on deep coverage was actually self-limiting, in the sense that it often didn't teach readers how to think about MySQL. As a result, this third edition has a different focus from the second edition. We still convey a lot of information, and we still emphasize the same goals, such as reliability and correctness. But we've also tried to imbue the book with a deeper purpose: we want fo teach the principles of why MySQL works as it does, not just the facts about how it works. We've included more illustrative stories and case studies, which demonstrate the principles in action. We build on these to try to answer questions such as "Given MySQL's internal architecture and operation, what practical effects arise in real usage?Why do those effects matter? How do they make MySQL well suited (or not well suited) for particular needs?" Ultimately, we hope that your knowledge of MySQL's internals will help you in situa tions beyond the scope of this book. And we hope that your newfound insight will help you to learn and practice a methodical approach to designing, maintaining, and trou bleshooting systems that are built on MySQL. How This Book Is Organized We fit a lot of complicated topics into this book. Here, we explain how we put them together in an order that makes them easier to learn. A Broad Overview Chapter 1, MySQL Architecture and History is dedicated to the basics--things you'll need to be familiar with before you dig in deeply. You need to understand how MySQL is organized before you'll be able to use it effectively. This chapter explains MySQL's architecture and key facts about its storage engines. It helps you get up to speed if you aren't familiar with some of the fundamentals of a relational database, including transactions. This chapter will also be useful if this book is your introduction to MySQL but you're already familiar with another database, such as Oracle. We also include a bit of historical context: the changes to'MySQL over time, recent ownership changes, and where we think it's headed. Building a Solid Foundation The early chapters cover material we hope you'll reference over and over as you use MySQL. Chapter 2, Benchmarking MySQL discusses the basics of benchmarking--that is, determining what sort of workload your server can handle, how fast it can perform certain tasks, and so on. Benchmarking is an essential skill for evaluating how the server behaves under load, but it's also important to know when it's not useful. Chapter 3, Profiling Server Performance introduces you to the response time-oriented approach we take to troubleshooting and diagnosing server performance problems.This framework has proven essential to solving some of the most puzzling cases we've seen. Although you might choose to modify our approach (we developed it by modilying Cary Millsap's approach, after all), we hope you'll avoid the pitfalls of not having any method at all. In Chapters 4 through 6, we introduce three topics that together form the foundation for a good logical and physical database design. In Chapter 4, Optimizing Schema and Data Types, we cover the various nuances of data types and table design. Chapter 5,Indexing for High Performance extends the discussion to indexes--that is, physical database design. A firm understanding of indexes and how to use them well is essential for using MySQL effective'y, so you'll probably find yourself returning to this chapter repeatedly. And Chapter 6, Query Performance Optimization wraps the topics together by explaining how MySQL executes queries and how you can take advantage of its query optimizer's strengths. This chapter also presents specific examples of many Common classes of queries, illustrating where MySQL does a good job and how to transform queries into forms that use its strengths. Up to this point, we've covered the basic topics that apply to any database: tables,indexes, data, and queries. Chapter 7, Advanced MySQL Features goes beyond the basics and shows you how MySQL's advanced features work. We examine topics such as partkioning, storedprocedures, triggers, and character sets. MySQL's implementation of these features is different from other databases, and a good-understanding of them can open up new opportunities for performance gains that you might not have thought about otherwise. Configuring Your Application The next two chapters discuss how to make MySQL, your application, and your hard ware workwell together. In Chapter 8, Optimizing Server Settings, we discuss how you can configure MySQL to make the most of your hardware and to be reliable and robust. Chapter 9, Operating System and Hardware Optimization explains how to get the most out of your operating system and hardware. We discuss solid-state storage in depth, and we suggest hardware configurations that might provide better performance for larger-scale applications. Both chapters explore MySQL internals to some degree. This is a recurring theme that continues all the way through the appendixes: learn how it works internally, and you'll be empowered to understand and reason about the consequences: MySQL as an Infrastructure Component MySQL doesn't exist in a vacuum. It's part of an overall application stack, and you'll need to build a robust overall architecture for your application. The next set of chapters is about how to do that. In Chapter 10, Replication, we discuss MySQL's killer feature: the ability to set up multiple servers that all stay in sync with a master server's changes. Unfortunately,replication is perhaps MySQL's most troublesome feature for some people. This doesn't have to be the case, and we show you how to ensure that it keeps runni.ng well.Chapter 11, Scaling MySQL discusses what scalability is (it's not the same thing as performance), why applications and systems don't scale, and what to do about it. If you do it right, you can scale MySQL to suit nearly any purpose. Chapter 12, High Availability delves into a related-but-distinct topic: how to ensure that MySQL stays hp and functions smoothly. In Chapter 13, MySQL in the Cloud, you'll learn about what's different when you run MySQL in cloud computing environments.
內(nèi)容概要
本書中,你將學到與MySQL數(shù)據(jù)庫模式、索引和查詢設計相關的所有高級技巧。通過使用這些技巧,你將能夠對。MySQL數(shù)據(jù)庫服務器、操作系統(tǒng)和硬件進行調優(yōu)以發(fā)揮它們的最大潛力。這本指南同時也提供了通過復制、負載均衡、高可用性及故障轉移等技術對應用進行擴展的安全實用方法。
《高性能MySQL(影印版第3版)由Baron Schwartz、Peter Zaitsev、 Vadim
Tkachenko著。在第三版中更新了MysQL數(shù)據(jù)庫和InnoDB存儲引擎在性能、特性和工具等相關領域取得的最新進展,不僅通過大量的特定示例講解了MySQL數(shù)據(jù)庫如何工作,同時也圍繞MysQL數(shù)據(jù)庫的設計原則,采用生動的故事和案例研究的形式解釋了其對應的工作原理。本書教給讀者如何采用MySQL的方式進行思考。
作者簡介
作者:(美國)施瓦茲(Baron Scbwartz) (美國)扎伊采夫(Peter Zaitsev) (美國)特卡申科(Vadim Tkacbenko) 施瓦茲(Schwartz B.),是Percona公司的首席性能架構師。他的主要工作是通過創(chuàng)建一系列工具和技術來提高MySQL數(shù)據(jù)庫的易用性和可靠性。 扎伊采夫(zaitsev P.),是Percona公司的首席執(zhí)行官和聯(lián)合創(chuàng)始人之一。作為一名數(shù)據(jù)庫內(nèi)核、計算機硬件和應用擴展技術領域的專家,他管理著MysQL團隊內(nèi)部的高性能技術組直到2006年。 特卡申科(Tkachenko V.)是Percona公司的首席技術官和聯(lián)合創(chuàng)始人之一。他領導著公司的開發(fā)團隊先后開發(fā)了Percona服務器、Percona XtraDB集群和Percona XtraBackup工具等產(chǎn)品。
書籍目錄
Foreword
Preface
1. MySQL Architecture and History
2. Benchmarking MySQL
3. Profiling Server Performance
4. Optimizing Schematic and Data Types
5. Indexing for High Performance
6. Query Performance Optimization
7. Advanced MySQL Features
8. Optimizing Server Setting
9. Operating System and Hardware Optimization
10. Replication
11. Scaling MySQL
12. High Availability
13. MySQL in the Cloud
14. Application-Level Optimization
15. Backup and Recovery
16. Tools for MySQL Use
A. Forks and Variants of MySQL
B. MySQL Server Status
C. Traferring Large Files
D. Using EXPLAIN
章節(jié)摘錄
版權頁: 插圖: Too many columns MySQL's storage engine API works by copying rows between the server and the storage engine in a row buffer format;the server then decodes the buffer into col-umns.But it can be costly to turn the row buffer into the row data structure with the decoded columns.MylSAM's fixed row format actually matches the server's row format exactly,so no conversion is needed.However,MylSAM's variable row format and InnoDB's row format always require conversion.The cost of this con-version depends on the number of columns.We discovered that this can become expensive when we investigated an issue with high CPU consumption for a cus-tomer with extremely wide tables (hundreds of columns),even though only a few columns were actually used.If you're planning for hundreds of columns,be aware that the server's performance characteristics will be a bit different. Too many joins The so-called entity-attribute-value (EAV) design pattern is a classic case of a uni-versally bad design pattern that especially doesn't work well in MySQL.MySQL has a limitation of 61 tables per join,and EAV databases require many self-joins. We've seen more than a few EAV databases eventually exceed this limit.Even at many fewer joins than 61,however,the cost of planning and optimizing the query can become problematic for MySQL.As a rough rule of thumb,it's better to have a dozen or fewer tables per query if you need queries to execute very fast with high concurrency. The all-powerful ENUM Beware of overusing ENUM.Here's an example we saw: CREATE TABLE ...( country enum('','0','1','2',...,'31') The schema was sprinkled liberally with this pattern.This would probably be a questionable design decision in any database with an enumerated value type,be-cause it really should be an integer that is foreign-keyed to a "dictionary" or "lookup" table anyway.But in MySQL,you can't add a new country to the list without an ALTER TABLE,which is a blocking operation in MySQL 5.0 and earlier,and even in 5.1 and newer if you add the value anywhere but at the end of the list.
媒體關注與評論
“同本書的前幾版相比,第三版是一本更加棒的書。這幾位作者是唯一具有資格寫這本書的人。我將繼續(xù)向他們學習,并希望你也能抽出時間這樣做。” ——Mark Callaghan Facebook軟件工程師
圖書封面
圖書標簽Tags
無
評論、評分、閱讀與下載