Your SlideShare is downloading. ×
What's new in MySQL 5.6
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

What's new in MySQL 5.6


Published on

A brief overview of notable new features in MySQL 5.6; mostly user-oriented. …

A brief overview of notable new features in MySQL 5.6; mostly user-oriented.

Presented in OracleWeek, Israel, 2012.

Published in: Technology

  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Seminar:Whats new in MySQL 5.6?Presenter: Shlomi NoachOracle ACEMySQL Community Member 2 copyright (c) 2012 Shlomi Noach
  • 2. The state of MySQL 5.6● MySQL 5.6 is being under development since early 2011● Uses a milestone based release model: milestone features are assumed to have RC quality● 5.6.7 (Release Candidate) recently announced 3 copyright (c) 2012 Shlomi Noach
  • 3. The state of MySQL 5.6● While 5.5 (first release under Oracles stewardship) was focused on performance, scale up and integrity, and had little focus on new features, 5.6 offers: – Loads of new usability features – Major improvements to InnoDB architecture – Optimizer enhancements – Major replication improvements – PERFORMANCE_SCHEMA: dozens new tables 4 copyright (c) 2012 Shlomi Noach
  • 4. New in MySQL 5.6● We discuss new & noteworthy under the following: – InnoDB – Replication – Optimizer – Partitioning 5 copyright (c) 2012 Shlomi Noach
  • 5. InnoDB● Once acquired both InnoBase and Sun Microsystems, Oracle directed more resources at InnoDB development as integral part of MySQL● InnoDB is today the default storage engine for MySQL● 5.6 brings new usability, maintainability and performance improvements to InnoDB 6 copyright (c) 2012 Shlomi Noach
  • 6. InnoDB: online DDL ● Arguably the #1 reason one would want to upgrade to 5.6 ● InnoDB now supports online, non-blocking ALTER TABLE operations for many DDL statements: – ADD/MODIFY/DROP COLUMN, ADD/DROP INDEX, ADD/DROP Foreign Keys, change of AUTO_INCREMENT, change of row format, compression, and more. 7 copyright (c) 2012 Shlomi Noach
  • 7. InnoDB: FULLTEXT ● FULLTEXT indexes now available on InnoDB ● Support same syntax as with MyISAM – Boolean search – Stopwords – Proximity ● Fills the last gap for MyISAM users to migrate to InnoDB 8 copyright (c) 2012 Shlomi Noach
  • 8. InnoDB: Transportable tables ● “move around” InnoDB tables by copying them via file system ● Allows for fast table duplicate; fast export of table between servers ● via: – FLUSH TABLES … FOR EXPORT – ALTER TABLE … DISCARD TABLESPACE – ALTER TABLE … IMPORT TABLESPACE 9 copyright (c) 2012 Shlomi Noach
  • 9. InnoDB: NoSQL access ● It is possible to access InnoDB via memcache API – Uses embedded memcached server – Via standard memcache clients – No need for SQL, avoids parsing, preparing, QEP evaluation ● However fully utilizing transactions; ACID compliant! – At current supporting single table – memcache writes batched; may require READ UNCOMMITED on SQL side 10 copyright (c) 2012 Shlomi Noach
  • 10. InnoDB: performance● InnoDB 5.6 performance improvements include: – Preloading buffer pool (cache flush to disk) – Adaptive REDO logs flushing – Better, more concurrent buffer flushing – Configurable tablespace location – UNDO logs on separate tablespace – Persistent stats – More... 11 copyright (c) 2012 Shlomi Noach
  • 11. Partitions● Introduced in 5.1● Features RANGE, LIST, HASH & KEY partitioning – 5.1 RANGE and LIST limited to integer partitioning keys● 5.5 introduced: – RANGE COLUMNS and LIST COLUMNS partitioning, removing said limitation – ALTER TABLE … TRUNCATE PARTITION● 5.6 boasts major partition improvements 12 copyright (c) 2012 Shlomi Noach
  • 12. Partition exchange ● Swap a partition with a table of the exact same structure – Either or both may contain data – Allows for quick insertion or extraction of data into/from partitioned table ● via: ALTER TABLE part_tbl EXCHANGE PARTITION part_name WITH TABLE tbl; 13 copyright (c) 2012 Shlomi Noach
  • 13. Explicit partition selection ● Limit a DML statement to a specific partition or set of partitions – Similar to partition pruning, but manual, and applies for SELECT, UPDATE, INSERT, REPLACE, DELETE, LOAD – Avoid partition lookup on complex search terms, or otherwise based on known heuristic ● via: UPDATE tbl PARTITION (p2, p3, p5) SET c=1 WHERE condition_holds 14 copyright (c) 2012 Shlomi Noach
  • 14. Partitions: lock pruning ● Ever since partitions were introduced in 5.1, locking has been an issue ● Even with partition pruning, locks were held over all table partitions – And although InnoDB uses row-level locking and is supposedly unaffected by table locks, the lock mechanism is still invoked – This caused for a known scenario of reduced performance on intensive INSERTs to a partitioned table ● With 5.6 this is alleviated; locks are expected to be placed only on relevant partitions. 15 copyright (c) 2012 Shlomi Noach
  • 15. Execution plans● Query Execution Plan (QEP) is boosted in 5.6 both internally (optimized plans) and usability-wise● Some notorious limitations are removed, and infamous QEP scenarios now fixed 16 copyright (c) 2012 Shlomi Noach
  • 16. Execution plans: subqueries ● Up till 5.5, subqueries & derived tables: – Evaluated as non-indexed temporary tables – Would, in common scenarios, re-evaluate throughout the query ● select * from actor where actor_id in (select actor_id from film_actor where film_id = 7) ● 5.6 introduces: – Indexes on derived tables – Semijoins avoid re-evaluation and skip execution phases 17 copyright (c) 2012 Shlomi Noach
  • 17. Execution plans: indexes ● Index optimizations include: – Index condition pushdown: better execution plans for queries where index can satisfy conditions ● This reduces MySQL-SE data transfer and allows for storage engine internal handling of conditions. – Improved index merge 18 copyright (c) 2012 Shlomi Noach
  • 18. Execution plans: EXPLAIN ● EXPLAIN will now work on INSERT, UPDATE & DELETE statements – Previously only on SELECT – Hacks used to convert UPDATE/DELETE statements into SELECT statements so as to guess QEP. The result was not authoritative. 19 copyright (c) 2012 Shlomi Noach
  • 19. Execution plans: EXPLAIN ● EXPLAIN FORMAT=JSON is introduced – Presenting execution plan in a JSON-tree format – Much more accurate output than EXPLAIN – Easy to parse and diagnose by automated tools ● Optimizer trace presents with actual execution steps taken after fact – Also in JSON format 20 copyright (c) 2012 Shlomi Noach
  • 20. Replication● New replication features make for: – Faster replication – Safer replication – Easier to maintain replication 21 copyright (c) 2012 Shlomi Noach
  • 21. Replication: GTID ● Global Transaction IDs are introduced into the binary logs, such that every statement has a globally unique ID ● A slave can connect to its master and auto-detect binlog position via GTID ● Easier to failover to another slave, or to move slaves along replication tree ● via: CHANGE MASTER TO MASTER_AUTO_POSITION = 1 22 copyright (c) 2012 Shlomi Noach
  • 22. Multithreaded slaves ● Based on a thread-per-database – Assumes different schemas completely unrelated ● Multithreaded replication breaks the years-old “single threaded slave” paradigm – In this paradigm a slave had to do all masters work utilizing one thread only – Very quickly leads to replication lag issues 23 copyright (c) 2012 Shlomi Noach
  • 23. Crashsafe replication ● “Standard” replication uses and relay- files to manage records of current replication status – These files not flushed to disk upon update – Cause for replication break (or worse – integrity loss) ● With 5.6, replication status can be written to system InnoDB tables – Being transactional, these are fully ACID 24 copyright (c) 2012 Shlomi Noach
  • 24. Replication: more ● Time delayed replication available via CHANGE MASTER TO MASTER_DELAY=... ● Binary log checksums allow for safer log transfer between hosts ● New set of utilities allows for easier replication maintenance ● Optimized row-based replication: only transfer actual row changes, not complete changed row 25 copyright (c) 2012 Shlomi Noach
  • 25. Thank you!● I blog at● Free and open source projects: – common_schema: DBAs framework for MySQL – openark-kit: common utilities for MySQL – mycheckpoint: lightweight, SQL oriented monitoring for MySQL● shlomi[at] 26 copyright (c) 2012 Shlomi Noach
  • 26. 27copyright (c) 2012 Shlomi Noach