mysql features for the enterprise
DESCRIPTION
MySQL main features, with emphasis of what's new in MySQL 5.5, and how to use the InnoDB plugin in 5.1TRANSCRIPT
![Page 1: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/1.jpg)
MySQLFeatures for the enterprise
Giuseppe MaxiaQA Director
Continuent, Inc
This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
Wednesday, December 1, 2010
![Page 2: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/2.jpg)
about me - Giuseppe Maxia
• a.k.a. The Data Charmer• QA Director at Continuent, Inc• Long time hacking with MySQL features• Formerly, MySQL community manager, database
consultant, designer, coder.• A passion for QA, open source, and community• Blogger
•http://datacharmer.blogspot.com
Wednesday, December 1, 2010
![Page 3: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/3.jpg)
Contents• Refresh of MySQL main features
• Future: MySQL 5.5✦ performance (InnoDB default engine,
Performance schema)✦ ease of use (partitioning, SIGNAL)✦ reliability (semisynch replication)
• Current: MySQL 5.1✦ performance: InnoDB plugin 1.0.13
Wednesday, December 1, 2010
![Page 4: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/4.jpg)
Contents• Refresh of MySQL main features
• Future: MySQL 5.5✦ performance (InnoDB default engine,
Performance schema)✦ ease of use (partitioning, SIGNAL)✦ reliability (semisynch replication)
• Current: MySQL 5.1✦ performance: InnoDB plugin 1.0.13
Wednesday, December 1, 2010
![Page 5: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/5.jpg)
Main features• Ease of use
• Installation
• Maintenance
• Reliability
• ACID compliant
• Built-in replication
• Performance
• Scalable
• Built-in partitioning
Wednesday, December 1, 2010
![Page 6: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/6.jpg)
And more ...• Stored routines
• Triggers
• Views
• Information and performance schema
• Event scheduler
• Pluggable functions
• Pluggable storage engines
Wednesday, December 1, 2010
![Page 7: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/7.jpg)
Installation
Wednesday, December 1, 2010
![Page 8: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/8.jpg)
As easy as• apt-get install mysql-server
• yum install mysql-server
Manual installation requires less than 15 minutes
Wednesday, December 1, 2010
![Page 9: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/9.jpg)
ACID
Wednesday, December 1, 2010
![Page 10: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/10.jpg)
MVCC storage engine
• Use Innodb
• Transactions
• Referential integrity
Wednesday, December 1, 2010
![Page 11: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/11.jpg)
Replication principles
Wednesday, December 1, 2010
![Page 12: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/12.jpg)
a simple web application
scheme
database server
web server
clients
r/w requests
Wednesday, December 1, 2010
![Page 13: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/13.jpg)
database server
web servers
load balancer
clients
r/w requests
scaling web requests
Wednesday, December 1, 2010
![Page 14: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/14.jpg)
writeread
database load on a simple
web application
85% 15%
Wednesday, December 1, 2010
![Page 15: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/15.jpg)
readwrite
database load on a successful web
application
20% 80%
Wednesday, December 1, 2010
![Page 16: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/16.jpg)
database server
web servers
load balancer
clients
r/w requests✘
scaling up means buying
a bigger database
server
Wednesday, December 1, 2010
![Page 17: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/17.jpg)
readwrite
the bigger database server will eventually
have the same problem
80%20%
Wednesday, December 1, 2010
![Page 18: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/18.jpg)
read/writemaster
read/onlyslaves
web servers
R/W
R/O
load balancer
load balancer
clients
a web application
scheme with replication
Wednesday, December 1, 2010
![Page 19: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/19.jpg)
read/writemaster
read/onlyslaves
readwriteread
database load with
replication
85% 15% 100%
Wednesday, December 1, 2010
![Page 20: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/20.jpg)
read/writemaster
read/onlyslaves
readwriteread
scaling database load
with replication
85% 15% 100%
Wednesday, December 1, 2010
![Page 21: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/21.jpg)
Replication assessmentwithout replication with replication
database handling
performance
Point in Time recovery
failover
write scaling
backup
read scaling
easy harder
high lower (binary logs)
none easy
none possible
none minimal
with downtime without downtime
none easy
Wednesday, December 1, 2010
![Page 22: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/22.jpg)
Partitioning
Wednesday, December 1, 2010
![Page 23: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/23.jpg)
Remember the MERGE tables?separate tablesrisk of duplicatesinsert in each tableno constraints
MERGE TABLE
Wednesday, December 1, 2010
![Page 24: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/24.jpg)
It isn't a merge table!One tableNo risk of duplicatesinsert in one tableconstraints enforced
PARTITIONED TABLE
Wednesday, December 1, 2010
![Page 25: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/25.jpg)
Partition pruning 1a - unpartitioned table - SINGLE RECORD
select * from table_name where colx = 120
Wednesday, December 1, 2010
![Page 26: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/26.jpg)
Partition pruning 1a - unpartitioned table - SINGLE RECORD
select * from table_name where colx = 120
INDEX
DATA
Wednesday, December 1, 2010
![Page 27: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/27.jpg)
Partition pruning 1c - unpartitioned table - RANGE
select * from table_name where colx between 120 and 230
Wednesday, December 1, 2010
![Page 28: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/28.jpg)
Partition pruning 2a - table partitioned by colx - SINGLE REC
select * from table_name where colx = 120
100-199
1-99
200-299
300-399
400-499
500-599
Wednesday, December 1, 2010
![Page 29: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/29.jpg)
Partition pruning 2a - table partitioned by colx - SINGLE REC
select * from table_name where colx = 120
DATA I
NDEX
100-199
1-99
200-299
300-399
400-499
500-599
Wednesday, December 1, 2010
![Page 30: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/30.jpg)
Partition pruning 2b - table partitioned by colx - SINGLE REC
select * from table_name where colx = 350
100-199
1-99
200-299
300-399
400-499
500-599
Wednesday, December 1, 2010
![Page 31: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/31.jpg)
Partition pruning 2c - table partitioned by colx - RANGE
100-199
1-99
200-299
300-399
400-499
500-599
select * from table_name where colx between 120 and 230
Wednesday, December 1, 2010
![Page 32: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/32.jpg)
Benchmarking results (huge server)engine 6 month rangeInnoDB 4 min 30sMyISAM 25.03sArchive 22 min 25sInnoDB partitioned by month 13.19MyISAM partitioned by year 6.31MyISAM partitioned by month 4.45Archive partitioned by year 16.67Archive partitioned by month 8.97
Wednesday, December 1, 2010
![Page 33: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/33.jpg)
Leveraging replication
Wednesday, December 1, 2010
![Page 34: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/34.jpg)
read/writemaster
read/onlyslaves
R/WR/O
load balancer
load balancing
Wednesday, December 1, 2010
![Page 35: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/35.jpg)
backup master
slaves
STOP SLAVE
remove slave from load balancer
START SLAVE
perform backup
attach slave to load
balancer
Let slave catch up
Wednesday, December 1, 2010
![Page 36: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/36.jpg)
master
slaves
STOP SLAVE
remove slave from load balancer
START SLAVE
calculate summary
tables
attach slave to load
balancer
Let slave catch up
makesummary
tables
Wednesday, December 1, 2010
![Page 37: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/37.jpg)
master
slave
innodbnon partitioned
slave
innodbnon partitionedinnodb
partitioned by range
slave
MyISAMpartitioned by range
Partitionsfor heavy statistics
Wednesday, December 1, 2010
![Page 38: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/38.jpg)
master
slave
innodbnon partitioned
slave
innodbnon partitioned
ARCHIVEpartitioned by range
(date)
slave
ARCHIVEpartitioned by range
(product)
slave
ARCHIVEpartitioned by range
(location)
Simulating multiple
dimensions
Wednesday, December 1, 2010
![Page 39: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/39.jpg)
Contents• Refresh of MySQL main features
• Future: MySQL 5.5✦ performance (InnoDB default engine,
Performance schema)✦ ease of use (partitioning, SIGNAL)✦ reliability (semisynch replication)
• Current: MySQL 5.1✦ performance: InnoDB plugin 1.0.13
Wednesday, December 1, 2010
![Page 40: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/40.jpg)
MySQL 5.5
• MySQL 5.5.7-rc released in November
• MySQL 5.5.x-GA coming in December
• Default storage engine is now InnoDB
• Lots of goodies
Wednesday, December 1, 2010
![Page 41: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/41.jpg)
Contents• Refresh of MySQL main features
• Future: MySQL 5.5✦ performance (InnoDB default
engine, Performance schema)✦ ease of use (partitioning, SIGNAL)✦ reliability (semisynch replication)
• Current: MySQL 5.1✦ performance: InnoDB plugin 1.0.13
Wednesday, December 1, 2010
![Page 42: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/42.jpg)
default engineselect @@version,@@storage_engine;+-----------+------------------+| @@version | @@storage_engine |+-----------+------------------+| 5.1.52 | MyISAM |+-----------+------------------+
select @@version, @@storage_engine;+-----------+------------------+| @@version | @@storage_engine |+-----------+------------------+| 5.5.7-rc | InnoDB |+-----------+------------------+
Wednesday, December 1, 2010
![Page 43: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/43.jpg)
Plugin versionselect @@version, @@innodb_version;+-----------+------------------+| @@version | @@innodb_version |+-----------+------------------+| 5.5.7-rc | 1.1.3 |+-----------+------------------+
Wednesday, December 1, 2010
![Page 44: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/44.jpg)
InnoDB at a glance
• Performance Improvements✦ Improved recovery performance✦ Multiple buffer pool instances✦ Multiple rollback segments✦ Native asynchronous I/O for Linux✦ Extended change buffering
Wednesday, December 1, 2010
![Page 45: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/45.jpg)
Faster!
• How fast?
• In my benchmarks, 10% to 50% faster.
• Others have reported much higher gains.
• You decide.
• Test it under your load.
Wednesday, December 1, 2010
![Page 46: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/46.jpg)
Contents• Refresh of MySQL main features
• Future: MySQL 5.5✦ performance (InnoDB default engine,
Performance schema)✦ ease of use (partitioning, SIGNAL)✦ reliability (semisynch replication)
• Current: MySQL 5.1✦ performance: InnoDB plugin 1.0.13
Wednesday, December 1, 2010
![Page 47: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/47.jpg)
PERFORMANCE SCHEMA
• PERFORMANCE_SCHEMA presents low level MySQL performance information
• Data can be cleared
• Filters with WHERE are allowed
• Must be enabled with --performance_schema
Wednesday, December 1, 2010
![Page 48: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/48.jpg)
performance schemaSELECT EVENT_ID, EVENT_NAME, TIMER_WAITFROM EVENTS_WAITS_HISTORY WHERE THREAD_ID = 13ORDER BY EVENT_ID;+----------+-----------------------------------------+------------+| EVENT_ID | EVENT_NAME | TIMER_WAIT |+----------+-----------------------------------------+------------+| 86 | wait/synch/mutex/mysys/THR_LOCK::mutex | 686322 || 87 | wait/synch/mutex/mysys/THR_LOCK_malloc | 320535 || 88 | wait/synch/mutex/mysys/THR_LOCK_malloc | 339390 || 89 | wait/synch/mutex/mysys/THR_LOCK_malloc | 377100 || 90 | wait/synch/mutex/sql/LOCK_plugin | 614673 || 91 | wait/synch/mutex/sql/LOCK_open | 659925 || 92 | wait/synch/mutex/sql/THD::LOCK_thd_data | 494001 || 93 | wait/synch/mutex/mysys/THR_LOCK_malloc | 222489 || 94 | wait/synch/mutex/mysys/THR_LOCK_malloc | 214947 || 95 | wait/synch/mutex/mysys/LOCK_alarm | 312993 |+----------+-----------------------------------------+------------+
Wednesday, December 1, 2010
![Page 49: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/49.jpg)
performance schemamysql> UPDATE SETUP_INSTRUMENTS SET ENABLED = 'NO' WHERE NAME = 'wait/synch/mutex/myisammrg/MYRG_INFO::mutex';
mysql> UPDATE SETUP_CONSUMERS SET ENABLED = 'NO' WHERE NAME = 'file_summary_by_instance';
Wednesday, December 1, 2010
![Page 50: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/50.jpg)
Contents• Refresh of MySQL main features
• Future: MySQL 5.5✦ performance (InnoDB default engine,
Performance schema)✦ ease of use (partitioning, SIGNAL)✦ reliability (semisynch replication)
• Current: MySQL 5.1✦ performance: InnoDB plugin 1.0.13
Wednesday, December 1, 2010
![Page 51: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/51.jpg)
MySQL 5.5 enhancements• PARTITION BY RANGE COLUMNS• PARTITION BY LIST COLUMNS• TO_SECONDS
51
Wednesday, December 1, 2010
![Page 52: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/52.jpg)
MySQL 5.5 enhancements
52
CREATE TABLE t ( dt date)PARTITION BY RANGE (TO_DAYS(dt))( PARTITION p01 VALUES LESS THAN (TO_DAYS('2007-01-01')), PARTITION p02 VALUES LESS THAN (TO_DAYS('2008-01-01')), PARTITION p03 VALUES LESS THAN (TO_DAYS('2009-01-01')), PARTITION p04 VALUES LESS THAN (MAXVALUE));
BEFORE
5.1
Wednesday, December 1, 2010
![Page 53: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/53.jpg)
MySQL 5.5 enhancements
53
SHOW CREATE TABLE t \G Table: tCreate Table: CREATE TABLE `t` ( `dt` date DEFAULT NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1/*!50100 PARTITION BY RANGE (TO_DAYS(dt))(PARTITION p01 VALUES LESS THAN (733042) ENGINE = MyISAM,[…]
BEFORE
5.1
Wednesday, December 1, 2010
![Page 54: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/54.jpg)
MySQL 5.5 enhancements
54
CREATE TABLE t ( dt date)PARTITION BY RANGE COLUMNS (dt)( PARTITION p01 VALUES LESS THAN ('2007-01-01'), PARTITION p02 VALUES LESS THAN ('2008-01-01'), PARTITION p03 VALUES LESS THAN ('2009-01-01'), PARTITION p04 VALUES LESS THAN (MAXVALUE));
AFTER5.5
Wednesday, December 1, 2010
![Page 55: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/55.jpg)
MySQL 5.5 enhancements
55
SHOW CREATE TABLE t Table: tCreate Table: CREATE TABLE `t` ( `dt` date DEFAULT NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1/*!50500 PARTITION BY RANGE COLUMNS(dt)(PARTITION p01 VALUES LESS THAN ('2007-01-01') ENGINE = MyISAM,[…]
AFTER5.5
Wednesday, December 1, 2010
![Page 56: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/56.jpg)
MySQL 5.5 - Multiple columns
56
CREATE TABLE t ( a int, b int)PARTITION BY RANGE COLUMNS (a,b)( PARTITION p01 VALUES LESS THAN (10,1), PARTITION p02 VALUES LESS THAN (10,10), PARTITION p03 VALUES LESS THAN (10,20), PARTITION p04 VALUES LESS THAN (MAXVALUE, MAXVALUE));
Wednesday, December 1, 2010
![Page 57: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/57.jpg)
57
CREATE TABLE employees ( emp_no int(11) NOT NULL, birth_date date NOT NULL, first_name varchar(14) NOT NULL, last_name varchar(16) NOT NULL, gender char(1) DEFAULT NULL, hire_date date NOT NULL) ENGINE=MyISAMPARTITION BY RANGE COLUMNS(gender,hire_date)(PARTITION p01 VALUES LESS THAN ('F','1990-01-01'), PARTITION p02 VALUES LESS THAN ('F','2000-01-01'), PARTITION p03 VALUES LESS THAN ('F',MAXVALUE), PARTITION p04 VALUES LESS THAN ('M','1990-01-01'), PARTITION p05 VALUES LESS THAN ('M','2000-01-01'), PARTITION p06 VALUES LESS THAN ('M',MAXVALUE), PARTITION p07 VALUES LESS THAN (MAXVALUE,MAXVALUE)
Wednesday, December 1, 2010
![Page 58: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/58.jpg)
MySQL 5.5 enhancements• TRUNCATE PARTITION• TO_SECONDS()
58
Wednesday, December 1, 2010
![Page 59: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/59.jpg)
Contents• Refresh of MySQL main features
• Future: MySQL 5.5✦ performance (InnoDB default engine,
Performance schema)✦ ease of use (partitioning, SIGNAL)✦ reliability (semisynch replication)
• Current: MySQL 5.1✦ performance: InnoDB plugin 1.0.13
Wednesday, December 1, 2010
![Page 60: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/60.jpg)
SIGNAL and RESIGNAL
• Allow error handling in stored routines
• The execution is passed to an error handler
• Accessible error values are SQLSTATE, MESSAGE_TEXT and MYSQL_ERRNO
• RESIGNAL can pass along the original or a new information
Wednesday, December 1, 2010
![Page 61: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/61.jpg)
Contents• Refresh of MySQL main features
• Future: MySQL 5.5✦ performance (InnoDB default engine,
Performance schema)✦ ease of use (partitioning, SIGNAL)✦ reliability (semisynch replication)
• Current: MySQL 5.1✦ performance: InnoDB plugin 1.0.13
Wednesday, December 1, 2010
![Page 62: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/62.jpg)
semi-synchronous replication
master
slave 1 slave 2
semisynch master plugin
semisynch slave plugin
Wednesday, December 1, 2010
![Page 63: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/63.jpg)
semi-synchronous replication
master
slave 1 slave 2
COMMIT
1
client
Wednesday, December 1, 2010
![Page 64: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/64.jpg)
semi-synchronous replication
master
slave 1 slave 2
2
client
binary logCOMMIT
Wednesday, December 1, 2010
![Page 65: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/65.jpg)
semi-synchronous replication
master
slave 1 slave 2
3
client
binary logCOMMIT
relay log
Wednesday, December 1, 2010
![Page 66: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/66.jpg)
semi-synchronous replication
master
slave 1 slave 2
4
client
binary logCOMMIT
relay log
confirm log reception
Wednesday, December 1, 2010
![Page 67: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/67.jpg)
semi-synchronous replication
master
slave 1 slave 2
5
client
binary logCOMMIT
relay log
Wednesday, December 1, 2010
![Page 68: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/68.jpg)
Contents• Refresh of MySQL main features
• Future: MySQL 5.5✦ performance (InnoDB default engine,
Performance schema)✦ ease of use (partitioning, SIGNAL)✦ reliability (semisynch replication)
• Current: MySQL 5.1✦ performance: InnoDB plugin 1.0.13
Wednesday, December 1, 2010
![Page 69: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/69.jpg)
Missed announcement
• A GA release
• As of MySQL 5.1.47
• The InnoDB plugin is GA
• Ready to use for immediate gains
Wednesday, December 1, 2010
![Page 70: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/70.jpg)
5.1
INNODB
1.0.
13Wednesday, December 1, 2010
![Page 71: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/71.jpg)
5.1
INNODB
1.0.
13
Wednesday, December 1, 2010
![Page 72: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/72.jpg)
INFORMATION SCHEMA table plugin
INFORMATION SCHEMA table plugin
INFORMATION SCHEMA table plugin
INFORMATION SCHEMA table plugin
MySQL Server
InnoDB plugin
Wednesday, December 1, 2010
![Page 73: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/73.jpg)
Installation (1)my.cnf
[mysqld]plugin_dir = /usr/local/mysql/lib/pluginignore_builtin_innodbplugin-load=innodb=ha_innodb_plugin.sodefault-storage-engine=InnoDBinnodb_file_per_table=1innodb_file_format=barracudainnodb_strict_mode=1
Wednesday, December 1, 2010
![Page 74: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/74.jpg)
Installation (1a)my.cnf
[mysqld]plugin-load=innodb=ha_innodb_plugin.so;innodb_trx=ha_innodb_plugin.so;innodb_locks=ha_innodb_plugin.so;innodb_lock_waits=ha_innodb_plugin.so;innodb_cmp=ha_innodb_plugin.so;innodb_cmp_reset=ha_innodb_plugin.so;innodb_cmpmem=ha_innodb_plugin.so;innodb_cmpmem_reset=ha_innodb_plugin.so#(all in one line with no spaces)
Wednesday, December 1, 2010
![Page 75: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/75.jpg)
Installation (2)SET GLOBAL innodb_fast_shutdown=0;
RESTART the server
Wednesday, December 1, 2010
![Page 76: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/76.jpg)
Installation - 2nd method (1)my.cnf
[mysqld]ignore_builtin_innodb
Wednesday, December 1, 2010
![Page 77: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/77.jpg)
Installation - 2nd method (2)SET GLOBAL innodb_fast_shutdown=0;
RESTART the server
Wednesday, December 1, 2010
![Page 78: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/78.jpg)
Installation - 2nd method (3)mysqlINSTALL PLUGIN INNODB SONAME 'ha_innodb_plugin.so';INSTALL PLUGIN INNODB_TRX SONAME 'ha_innodb_plugin.so';INSTALL PLUGIN INNODB_LOCKS SONAME 'ha_innodb_plugin.so';INSTALL PLUGIN INNODB_LOCK_WAITS SONAME 'ha_innodb_plugin.so';INSTALL PLUGIN INNODB_CMP SONAME 'ha_innodb_plugin.so';INSTALL PLUGIN INNODB_CMP_RESET SONAME 'ha_innodb_plugin.so';INSTALL PLUGIN INNODB_CMPMEM SONAME 'ha_innodb_plugin.so';INSTALL PLUGIN INNODB_CMPMEM_RESET SONAME 'ha_innodb_plugin.so';
Wednesday, December 1, 2010
![Page 79: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/79.jpg)
Installation - 2nd method (4)my.cnf
[mysqld]
default-storage-engine=InnoDBinnodb_file_per_table=1innodb_file_format=barracudainnodb_strict_mode=1
Wednesday, December 1, 2010
![Page 80: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/80.jpg)
Installation - 2nd method (5)SET GLOBAL innodb_fast_shutdown=0;
RESTART the server
Wednesday, December 1, 2010
![Page 81: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/81.jpg)
Installation differences• Method 1 (plugin-load in my.cnf)
✦ Only one operation✦ But error prone (one looooong command)✦ plugins not stored in mysql.plugin table
• Method 2 (install plugin) ✦ plugin info saved to mysql.plugin table✦ Easier to write✦ 2 restarts required
Wednesday, December 1, 2010
![Page 82: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/82.jpg)
CAVEAT
• If you uninstall the InnoDB plugin, remember:✦ The tables are not backward compatible✦ You must uninstall all the
INFORMATION_SCHEMA plugin tables BEFORE removing the InnoDB plugin
✦ If the plugin is busy, it may not be removed until you restart the server
Wednesday, December 1, 2010
![Page 83: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/83.jpg)
hands on
Wednesday, December 1, 2010
![Page 84: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/84.jpg)
Checking installationselect @@version, @@innodb_version;+-----------+------------------+| @@version | @@innodb_version |+-----------+------------------+| 5.1.52 | 1.0.13 |+-----------+------------------+
DEM
O
Wednesday, December 1, 2010
![Page 85: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/85.jpg)
Detecting lockssession1> select c from t1 for update;+------+| c |+------+| aaa || bbb || ccc |+------+
Wednesday, December 1, 2010
![Page 86: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/86.jpg)
Detecting lockssession2> select c from t1 for update;
[… waiting]
Wednesday, December 1, 2010
![Page 87: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/87.jpg)
Detecting lockssession3> select i from t1 for update;
[… waiting]
Wednesday, December 1, 2010
![Page 88: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/88.jpg)
getting locks informationSELECT r.trx_id waiting_trx_id, r.trx_mysql_thread_id waiting_thread, r.trx_query waiting_query, b.trx_id blocking_trx_id, b.trx_mysql_thread_id blocking_thread, b.trx_query blocking_query FROM innodb_lock_waits w INNER JOIN innodb_trx b ON b.trx_id = w.blocking_trx_id INNER JOIN innodb_trx r ON r.trx_id = w.requesting_trx_id
Wednesday, December 1, 2010
![Page 89: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/89.jpg)
getting locks information
Wednesday, December 1, 2010
![Page 90: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/90.jpg)
getting locks information************* 1. row ************** waiting_trx_id: 711 waiting_thread: 3 waiting_query: select c from t1 for updateblocking_trx_id: 710blocking_thread: 2 blocking_query: select i from t1 for update
Wednesday, December 1, 2010
![Page 91: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/91.jpg)
getting locks information************* 2. row ************** waiting_trx_id: 711 waiting_thread: 3 waiting_query: select c from t1 for updateblocking_trx_id: 70Fblocking_thread: 1 blocking_query: NULL
Wednesday, December 1, 2010
![Page 92: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/92.jpg)
getting locks information************* 3. row ************** waiting_trx_id: 710 waiting_thread: 2 waiting_query: select i from t1 for updateblocking_trx_id: 70Fblocking_thread: 1 blocking_query: NULL
Wednesday, December 1, 2010
![Page 93: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/93.jpg)
Read more
Wednesday, December 1, 2010
![Page 94: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/94.jpg)
The MySQL online manual
http://dev.mysql.com/docWednesday, December 1, 2010
![Page 95: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/95.jpg)
High Performance MySQL
Wednesday, December 1, 2010
![Page 96: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/96.jpg)
MySQL High Availability
Wednesday, December 1, 2010
![Page 97: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/97.jpg)
Web Operations
Wednesday, December 1, 2010
![Page 98: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/98.jpg)
Cloud Application Architectures
Wednesday, December 1, 2010
![Page 99: Mysql features for the enterprise](https://reader034.vdocuments.site/reader034/viewer/2022042601/54c6d6e04a7959a4578b45a9/html5/thumbnails/99.jpg)
e-mail: [email protected]: @datacharmer
Contact Information
Continuent Web Site:http://www.continuent.com
Tungsten Projecthttp://sourceforge.net/projects/tungsten
This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
Wednesday, December 1, 2010