SlideShare a Scribd company logo
MySQL 5.7 in a Nutshell
Alexander Rubin
Principal Architect, Percona
December 6, 2015
www.percona.com
About Me
•  Working with MySQL for over 10 years
–  Started at MySQL AB, then Sun Microsystems,
–  then Oracle (MySQL Consulting)
–  Joined Percona 2 years ago
My name is Alexander Rubin
https://www.linkedin.com/in/alexanderrubin
www.percona.com
Performance and Scalability
–  Enhanced Speed: MySQL 5.7 delivered 1,600,000 queries per
second (QPS) – 3x faster than MySQL 5.6.
–  Optimized InnoDB: New capabilities include increased
performance and concurrency
–  More Robust Replication:
•  multi-source replication
•  enhanced Global Transaction Identifiers (GTIDs)
•  improved multi-threaded slaves
–  Enhanced Optimizer: A new dynamic cost model provides
better query performance and greater user control.
Agenda: New MySQL 5.7 features
www.percona.com
Manageability enhancements
§  JSON Data Type and Calculated Fields: Allows for efficient and
flexible storage, search, and manipulation of schema-less data.
§  Performance Schema: Enables instrumentation for memory,
transactions, stored routines, prepared statements, replication,
and locks.
§  MySQL SYS Schema: Provides helper objects that answer
common performance, health, usage, and monitoring questions.
§  Improved Security: Delivers easier and safer instance
initialization, setup and management.
§  Expanded Geographic Information System (GIS) Support:
Spatial index support in InnoDB, GeoJSON, and GeoHash.
Agenda: New MySQL 5.7 features
www.percona.com
MySQL 5.7 Performance Improvements
Sysbench Becnhmark
*Information from Oracle OpenWorld presentation by Geir Hoydalsvik
Starts with 8 Threads
What about 2-4 threads?
www.percona.com
MySQL 5.7: Single-threaded workload
§  Multi-threaded workload looks great
§  Single-threaded workload shows some regression
https://bugs.mysql.com/bug.php?id=68825
http://smalldatum.blogspot.co.uk/2014/10/single-thread-performance-in-mysql-575.html
www.percona.com
MySQL 5.7: InnoDB, NoSQL With Memcached
*Information from Oracle OpenWorld presentation by Geir Hoydalsvik
www.percona.com
Sysbench OLTP Read Write
*Information from Oracle OpenWorld presentation by Geir Hoydalsvik
www.percona.com
InnoDB vs. MyISAM in v. 5.7
Feature MyISAM InnoDB
Full Text Indexes yes Since MySQL 5.6
Portable tables
(tablespaces)
yes Since MySQL 5.6
Spatial Indexes/RTREE
(GIS)
yes Since MySQL 5.7
Last update for table yes Since MySQL 5.7
(http://dev.mysql.com/worklog/task/?
id=6658)
Suitable for temp tables yes Since MySQL 5.7
Also complex selects uses
InnoDB ondisk temp tables
Fast count(*) yes *Faster in MySQL 5.7 but
does not store counter
www.percona.com
–  Performance: Buffer pool improvements
–  Performance: Better Redo log handling and better index->lock handling
–  Performance: DDL & Truncate improvements
–  Performance: Temporary Table Optimizations
–  Feature: Native Partitioning for InnoDB
–  Feature: Dynamic buffer pool size re-size, more online alter table ops
–  Feature: UNDO Log Space Management
–  Feature: Transparent PageIO Compression
–  Feature: GIS indexes
–  Miscellaneous
•  Implement update_time for InnoDB tables
•  Improve select count(*) performance by using handler::records();
•  Improve recovery, redo log tablespace meta data changes
InnoDB Improvements Overview
www.percona.com
InnoDB: Online Operations
•  Resize the InnoDB Buffer Pool online
•  More Online ALTER TABLE operations
•  Enlarge VARCHAR, Rename Index
•  More dynamic configuration variables
•  New variables are dynamic
•  Work to make existing variables dynamically
settable
www.percona.com
§  May be useful in virtual enviroments where you
can resize RAM online
innodb_buffer_pool_chunk_size – resize done in
chunk size
§  Example:
mysql>	
  SET	
  GLOBAL	
  
innodb_buffer_pool_size=4*1024*1024*102
4;	
  -­‐-­‐	
  4G	
  
http://dev.mysql.com/doc/refman/5.7/en/
innodb-­‐buffer-­‐pool-­‐online-­‐resize.html	
  	
  
Dynamic buffer pool re-size
www.percona.com
InnoDB - Bulk Load for Create
Index
•  Much faster INDEX creation and bulk loads
•  Performance results show
•  2-3x performance improvement for ADD/CREATE
INDEX operations
•  2-5% improvement for standard INSERT operations
www.percona.com
InnoDB Temporary Tables
•  New separate tablespace for temporary tables
•  Optimize DML operations
•  No REDO logging, no change buffering, less locking
•  InnoDB storage engine is used for on-disk
internal temporary tables
•  Complex select requiring ondisk temp tables will now
use InnoDB by default (controlled by
internal_tmp_disk_storage_engine variable)
http://dev.mysql.com/doc/refman/5.7/en/server-system-
variables.html#sysvar_internal_tmp_disk_storage_engine
http://mysqlserverteam.com/mysql-5-7-innodb-intrinsic-tables/
www.percona.com
Transparent Page Compression
•  Transparent Page Level Compression
•  Happens transparently in background threads
•  For supported Linux kernels and filesystems
•  Uses sparse file and "hole punching" support
•  Reduces IO
Applies to all InnoDB data, including the system tablespace and
UNDO logs
But – many file systems do not support large number of "holes" well
https://dev.mysql.com/doc/refman/5.7/en/innodb-page-
compression.html
www.percona.com
GIS - InnoDB Spatial Indexes
–  Full transactional
support
–  Only supports 2D data
for now
•  Use helper functions
for distance
calculations
*Graphics from Oracle OpenWorld presentation
by Geir Hoydalsvik
www.percona.com
•  GeoHash
–  Quick lookups for exact matches
–  Not very accurate for proximity searches
•  GeoJSON
•  Helper functions (ST_Distance_Sphere)
GIS - Additional Features
www.percona.com
mysql>	
  SELECT	
  shape	
  into	
  @zip_shape	
  FROM	
  zcta.tl_2013_us_zcta510	
  	
  
WHERE	
  zcta5ce10='27701’;	
  
Query	
  OK,	
  1	
  row	
  affected	
  (0.20	
  sec)	
  
	
  
mysql>	
  SELECT	
  name,	
  	
  
	
  	
  	
  	
  	
  	
  	
  ST_Distance_Sphere(shape,	
  st_centroid(@zip_shape)	
  )	
  as	
  dist,	
  	
  
	
  	
  	
  	
  	
  	
  	
  ST_AsGeoJSON(shape)	
  as	
  GeoJSON,	
  
	
  	
  	
  	
  	
  	
  	
  ST_GeoHash(shape,	
  16)	
  as	
  GeoHash	
  
	
  	
  	
  	
  	
  	
  	
  FROM	
  points	
  	
  
	
  	
  	
  	
  	
  	
  	
  WHERE	
  ST_Within(shape,	
  @zip_shape)	
  	
  
	
  	
  	
  	
  	
  	
  	
  and	
  other_tags	
  like	
  '%"amenity"=>"cafe"%'	
  LIMIT	
  1G	
  
	
  
***************************	
  1.	
  row	
  ***************************	
  
	
  	
  	
  name:	
  Blue	
  Coffee	
  Cafe	
  
	
  	
  	
  dist:	
  374.9045320478079	
  
GeoJSON:	
  {"type":	
  "Point",	
  "coordinates":	
  [-­‐78.9013567,	
  35.996332]}	
  
GeoHash:	
  dnruu8cvc4sk26qz	
  
1	
  row	
  in	
  set	
  (0.02	
  sec)	
  
	
  
	
  
GIS - Example
www.percona.com
Generated (Virtual) Columns
CREATE	
  TABLE	
  `ontime`	
  (	
  
	
  	
  `id`	
  int(11)	
  NOT	
  NULL	
  AUTO_INCREMENT,	
  
	
  	
  `YearD`	
  year(4)	
  NOT	
  NULL,	
  
	
  	
  `FlightDate`	
  datetime	
  DEFAULT	
  NULL,	
  
	
  	
  `Carrier`	
  char(2)	
  DEFAULT	
  NULL,	
  
	
  	
  `OriginAirportID`	
  int(11)	
  DEFAULT	
  NULL,	
  
	
  	
  `OriginCityName`	
  varchar(100)	
  DEFAULT	
  NULL,	
  
	
  	
  `OriginState`	
  char(2)	
  DEFAULT	
  NULL,	
  
	
  	
  `DestAirportID`	
  int(11)	
  DEFAULT	
  NULL,	
  
	
  	
  `DestCityName`	
  varchar(100)	
  DEFAULT	
  NULL,	
  
	
  	
  `DestState`	
  char(2)	
  DEFAULT	
  NULL,	
  
...	
  
`Flight_dayofweek`	
  tinyint(4)	
  	
  
GENERATED	
  ALWAYS	
  AS	
  (dayofweek(FlightDate))	
  VIRTUAL,	
  	
  	
  
PRIMARY	
  KEY	
  (`id`)	
  
)	
  ENGINE=InnoDB;	
  
alter	
  table	
  ontime	
  add	
  key	
  (Flight_dayofweek);	
  
	
  
https://www.percona.com/blog/2015/04/29/generated-­‐virtual-­‐columns-­‐in-­‐
mysql-­‐5-­‐7-­‐labs/	
  
https://dev.mysql.com/worklog/task/?id=8114	
  
Does not store the column
But INDEX it
SELECT	
  Flight_dayofweek,	
  count(*)	
  	
  
FROM	
  ontime_sm_virtual	
  	
  	
  
GROUP	
  BY	
  Flight_dayofweek	
  
www.percona.com
mysql>	
  EXPLAIN	
  SELECT	
  carrier,	
  count(*)	
  	
  
	
  	
  	
  	
  	
  	
  	
  FROM	
  ontime_sm_virtual	
  	
  	
  
	
  	
  	
  	
  	
  	
  	
  WHERE	
  Flight_dayofweek	
  =	
  7	
  group	
  by	
  carrierG	
  
***************************	
  1.	
  row	
  ***************************	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  id:	
  1	
  
	
  	
  select_type:	
  SIMPLE	
  
	
  	
  	
  	
  	
  	
  	
  	
  table:	
  ontime_sm_virtual	
  
	
  	
  	
  partitions:	
  NULL	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  type:	
  ref	
  
possible_keys:	
  Flight_dayofweek	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  key:	
  Flight_dayofweek	
  
	
  	
  	
  	
  	
  	
  key_len:	
  2	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ref:	
  const	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  rows:	
  165409	
  
	
  	
  	
  	
  	
  filtered:	
  100.00	
  
	
  	
  	
  	
  	
  	
  	
  	
  Extra:	
  Using	
  where;	
  Using	
  temporary;	
  Using	
  filesort	
  
1	
  row	
  in	
  set,	
  1	
  warning	
  (0.00	
  sec)	
  
	
  
Using index
Generated (Virtual) Columns
www.percona.com
JSON Support
mysql>	
  create	
  table	
  json_test	
  (	
  
id	
  int	
  primary	
  key	
  auto_increment,	
  	
  
data	
  json	
  
)	
  engine=InnoDB;	
  
Query	
  OK,	
  0	
  rows	
  affected	
  (0.02	
  sec)	
  
	
  
	
  
mysql>	
  select	
  *	
  from	
  json_test	
  where	
  data-­‐>'$.type'	
  =	
  'Point'	
  limit	
  1;	
  
+-­‐-­‐-­‐-­‐+-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐+	
  
|	
  id	
  |	
  data	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  |	
  
+-­‐-­‐-­‐-­‐+-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐+	
  
|	
  	
  1	
  |	
  {"type":	
  "Point",	
  "coordinates":	
  [-­‐87.9101245,	
  41.7585879]}	
  |	
  
+-­‐-­‐-­‐-­‐+-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐+	
  
	
  
	
  
	
  
	
  
	
  
Same as
JSON_EXTRACT(data,"$.type”)
www.percona.com
JSON Support: Indexes
mysql>	
  explain	
  select	
  *	
  from	
  json_test	
  where	
  data-­‐>'$.type'	
  =	
  'Point'	
  limit	
  1G	
  
***************************	
  1.	
  row	
  ***************************	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  id:	
  1	
  
	
  	
  select_type:	
  SIMPLE	
  
	
  	
  	
  	
  	
  	
  	
  	
  table:	
  json_test	
  
	
  	
  	
  partitions:	
  NULL	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  type:	
  ALL	
  
possible_keys:	
  NULL	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  key:	
  NULL	
  
	
  	
  	
  	
  	
  	
  key_len:	
  NULL	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ref:	
  NULL	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  rows:	
  996823	
  
	
  	
  	
  	
  	
  filtered:	
  100.00	
  
	
  	
  	
  	
  	
  	
  	
  	
  Extra:	
  Using	
  where	
  
	
  
mysql>	
  alter	
  table	
  json_test	
  	
  
add	
  data_type	
  varchar(255)	
  GENERATED	
  ALWAYS	
  AS	
  (data-­‐>'$.type')	
  VIRTUAL;	
  
Query	
  OK,	
  0	
  rows	
  affected	
  (0.00	
  sec)	
  
Records:	
  0	
  	
  Duplicates:	
  0	
  	
  Warnings:	
  0	
  
	
  
mysql>	
  alter	
  table	
  json_test	
  add	
  key	
  (data_type);	
  
Query	
  OK,	
  0	
  rows	
  affected	
  (2.51	
  sec)	
  
Records:	
  0	
  	
  Duplicates:	
  0	
  	
  Warnings:	
  0	
  
	
  
	
  
www.percona.com
JSON Support: Indexes
mysql>	
  explain	
  select	
  *	
  from	
  json_test	
  where	
  data-­‐>'$.type'	
  =	
  'Point'	
  limit	
  1G	
  
***************************	
  1.	
  row	
  ***************************	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  id:	
  1	
  
	
  	
  select_type:	
  SIMPLE	
  
	
  	
  	
  	
  	
  	
  	
  	
  table:	
  json_test	
  
	
  	
  	
  partitions:	
  NULL	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  type:	
  ref	
  
possible_keys:	
  data_type	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  key:	
  data_type	
  
	
  	
  	
  	
  	
  	
  key_len:	
  258	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ref:	
  const	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  rows:	
  1	
  
	
  	
  	
  	
  	
  filtered:	
  100.00	
  
	
  	
  	
  	
  	
  	
  	
  	
  Extra:	
  NULL	
  
	
  
	
  
	
  
	
  
www.percona.com
Replication Improvements
Multi-Source Replication
(slave can have multiple masters)
Better Multi-Threaded Slaves
(does not require multiple databases)
Better GTID
(online GTID deployment)
Group Replication Plugin
(virtual synchronous replication)
www.percona.com
MySQL Replication Topologies
Master > Slave
Masters > Slave (Multi-Source), Since 5.7
Master > Slaves
Master > Slave > Slaves
•  Now 1 replication slave can have many master servers!
•  Important for BI/Data Science/Ad-hoc analytics
www.percona.com
MySQL 5.7: Optimizer
Improvements
•  UNION ALL queries no longer use temporary
tables
•  Improved optimizations for queries with IN
expressions
•  Improved optimizations for full-text queries
•  More efficient sorting
www.percona.com
*************************** 1. row ***************************
table: ontime_2012
key: covered
... Removed ...
Extra: Using where; Using index
*************************** 2. row ***************************
table: ontime_2012
key: covered
... Removed ...
Extra: Using where; Using index
*************************** 3. row ***************************
id: NULL
select_type: UNION RESULT
table: <union1,2>
type: ALL
possible_keys: NULL
key: NULL
key_len: NULL
ref: NULL
rows: NULL
Extra: Using temporary
Temporary Table for UNION ALL
5.6: Will create temp table (as shown)
5.7: Do not materialize in temporary
tables (unless used for sorting) rows
are sent directly to client
5.7: Client will receive the first row
faster
5.7: Less memory and disk
consumption
www.percona.com
Optimizations for IN Expressions
•  MySQL 5.7: IN queries with row value expressions
executed using range scans.
•  Imagine that you got list of IDs from Full Text Search solution (solr/
elasticsearch/sphinx)
•  Now I need to get the actual documents
	
  
	
  
mysql>	
  select	
  name,	
  other_tags	
  from	
  poi_info	
  	
  	
  
WHERE	
  osm_id	
  in	
  (367909272,	
  367841688,	
  493001986,	
  ...);	
  
	
  
www.percona.com
Performance Schema
improvements
Memory
Instrumentations
–  Memory used
(bytes)
–  Operation counts
–  Type of memory
used (caches,
internal buffers,
etc)
Statement
Instrumentations
–  Stored
Procedures
–  Stored Functions
–  Prepared
Statements
–  Transactions
Other
Instrumentation
–  Replication slave
status
–  MDL lock
instrumentation
–  User variables
per thread
–  Server stage
tracking
–  Track long
running SQL
www.percona.com
SYS Schema
Included in MySQL 5.7
Get the memory usage per user with SYS schema:
	
  
	
  
	
  
	
  
mysql>	
  update	
  
performance_schema.setup_instruments	
  	
  
set	
  enabled='YES',	
  timed='YES'	
  	
  
where	
  name	
  like	
  'memory/%';	
  
Query	
  OK,	
  375	
  rows	
  affected	
  (0.00	
  sec)	
  
Rows	
  matched:	
  375	
  	
  Changed:	
  375	
  	
  
Warnings:	
  0	
  
	
  
	
  
mysql>	
  select	
  *	
  from	
  
sys.memory_global_totalG	
  
***************************	
  1.	
  row	
  
***************************	
  
total_allocated:	
  90.20	
  MiB	
  
1	
  row	
  in	
  set	
  (0.01	
  sec)	
  
	
  
mysql>	
  select	
  *	
  from	
  
sys.memory_by_user_by_current_bytesG	
  
***************************	
  1.	
  row	
  
***************************	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  user:	
  root	
  
current_count_used:	
  42	
  
	
  current_allocated:	
  361.03	
  KiB	
  
	
  current_avg_alloc:	
  8.60	
  KiB	
  
	
  current_max_alloc:	
  248.04	
  KiB	
  
	
  	
  	
  total_allocated:	
  46.34	
  GiB	
  
***************************	
  2.	
  row	
  
***************************	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  user:	
  background	
  
current_count_used:	
  0	
  
	
  current_allocated:	
  0	
  bytes	
  
	
  current_avg_alloc:	
  0	
  bytes	
  
	
  current_max_alloc:	
  0	
  bytes	
  
	
  	
  	
  total_allocated:	
  14.72	
  KiB	
  
2	
  rows	
  in	
  set	
  (0.01	
  sec)	
  
www.percona.com
Improved MDL locking
•  Removes bottlenecks around DML access to a
single table
•  10% increased throughput in OLTP_RO/
POINT_SELECT sysbench
•  Optimized for typical DML heavy workloads
http://www.chriscalender.com/troubleshooting-waiting-for-table-metadata-lock-errors-
for-both-myisam-and-innodb-tables/
www.percona.com
Security - Encryption, Passwords,
Installation
•  Deployment: enable secure unattended install
by default
•  Random password set on install
•  Removed anonymous accounts
•  Deployment without test account, schema, demo
files
•  AES 256 Encryption
•  Password rotation policies
•  Can be set globally, and at the user level
www.percona.com
Explain on a Running Query
mysql>	
  show	
  processlistG	
  
...	
  
	
  	
  	
  	
  	
  Id:	
  8	
  
Command:	
  Query	
  
	
  	
  	
  Time:	
  90	
  
	
  	
  State:	
  Sending	
  data	
  
	
  	
  	
  Info:	
  select	
  count(*),	
  osm_id	
  from	
  points_new	
  group	
  by	
  osm_id	
  
	
  
mysql>	
  explain	
  for	
  connection	
  8G	
  	
  
***************************	
  1.	
  row	
  ***************************	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  id:	
  1	
  
	
  	
  select_type:	
  SIMPLE	
  
	
  	
  	
  	
  	
  	
  	
  	
  table:	
  points_new	
  
	
  	
  	
  partitions:	
  NULL	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  type:	
  ALL	
  
possible_keys:	
  NULL	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  key:	
  NULL	
  
	
  	
  	
  	
  	
  	
  key_len:	
  NULL	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ref:	
  NULL	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  rows:	
  11368798	
  
	
  	
  	
  	
  	
  filtered:	
  100.00	
  
	
  	
  	
  	
  	
  	
  	
  	
  Extra:	
  Using	
  temporary;	
  Using	
  filesort	
  
	
  
Shows query plan on connection <id>
Applicable for SELECT/INSERT/
DELETE/UPDATE
www.percona.com
New Data Dictionary, New
Tablespace Management (future)
•  SaaS case: 50K databases inside single instance
•  ~ 1M tables = 2M files inside MySQL datadir
•  InnoDB tables replace .frm, .trg, .trn, .par files
•  Ability to create 1 tablespace for multiple tables
www.percona.com
FAQ
Q: Do you recommend upgrading to 5.7 right now?
A: As with all upgrades to a newer version it should be tested.
You can expect to see bugs.
Upgrade non-critical replication slaves first (i.e. reporting slaves)
Use pt-upgrade to test for any regressions
(https://www.percona.com/doc/percona-toolkit/2.2/pt-upgrade.html)
Q: When Percona Server 5.7 will be released as GA?
A: We expect to have a release around the end of January 2016
Please note that this date is approximate as there is always high risk
of a large amount of bugs to be discovered following a major release.
www.percona.com
Special Thanks
Mike Frank - Senior Product Manager, Oracle
Geir Høydalsvik - Software Development Director, Oracle
Presented “What’s New in MySQL 5.7”
Sunny Bains - Senior Engineering Manager, Oracle
Presented “MySQL 5.7: InnoDB—What’s New”
Mark Leith – Senior Software Development Manager, Oracle
Developer of SYS Schema
Chris Calender - Principal Support Engineer for MariaDB
Great blog posts explaining metadata locking
http://www.chriscalender.com/tracking-metadata-locks-mdl-in-mysql-5-7/
All Oracle MySQL Developers for the great MySQL 5.7 release!
www.percona.com
Thank you!
https://www.linkedin.com/in/alexanderrubin
Alexander Rubin

More Related Content

What's hot (20)

PPT
MySQL 5.6 Updates
Dave Stokes
 
ODP
MySQL Enterprise Portfolio
Abel Flórez
 
PDF
MySQL 5.7 -- SCaLE Feb 2014
Dave Stokes
 
PDF
My sql crashcourse_intro_kdl
sqlhjalp
 
PDF
MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)
Aurimas Mikalauskas
 
PDF
My sql 5.7-upcoming-changes-v2
Morgan Tocker
 
PPTX
MySQL Tech Tour 2015 - 5.7 InnoDB
Mark Swarbrick
 
PDF
My sql crashcourse_2012
sqlhjalp
 
PDF
MySQL 5.5&5.6 new features summary
Louis liu
 
PDF
MySQL Performance Best Practices
Olivier DASINI
 
PDF
MySQL 5.7 Replication News
Ted Wennmark
 
PDF
Mysql User Camp : 20th June - Mysql New Features
Tarique Saleem
 
PDF
MySQL For Oracle Developers
Ronald Bradford
 
PDF
Mysql nowwhat
sqlhjalp
 
PDF
2012 scale replication
sqlhjalp
 
PDF
MySQL 5.7: What's New, Nov. 2015
Mario Beck
 
PDF
AUSOUG Oracle Password Security
Stefan Oehrli
 
PDF
MySQL Performance Metrics that Matter
Morgan Tocker
 
PDF
My sql 56_roadmap_april2012
sqlhjalp
 
PDF
REST in Piece - Administration of an Oracle Cluster/Database using REST
Christian Gohmann
 
MySQL 5.6 Updates
Dave Stokes
 
MySQL Enterprise Portfolio
Abel Flórez
 
MySQL 5.7 -- SCaLE Feb 2014
Dave Stokes
 
My sql crashcourse_intro_kdl
sqlhjalp
 
MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)
Aurimas Mikalauskas
 
My sql 5.7-upcoming-changes-v2
Morgan Tocker
 
MySQL Tech Tour 2015 - 5.7 InnoDB
Mark Swarbrick
 
My sql crashcourse_2012
sqlhjalp
 
MySQL 5.5&5.6 new features summary
Louis liu
 
MySQL Performance Best Practices
Olivier DASINI
 
MySQL 5.7 Replication News
Ted Wennmark
 
Mysql User Camp : 20th June - Mysql New Features
Tarique Saleem
 
MySQL For Oracle Developers
Ronald Bradford
 
Mysql nowwhat
sqlhjalp
 
2012 scale replication
sqlhjalp
 
MySQL 5.7: What's New, Nov. 2015
Mario Beck
 
AUSOUG Oracle Password Security
Stefan Oehrli
 
MySQL Performance Metrics that Matter
Morgan Tocker
 
My sql 56_roadmap_april2012
sqlhjalp
 
REST in Piece - Administration of an Oracle Cluster/Database using REST
Christian Gohmann
 

Similar to MySQL 5.7 in a Nutshell (20)

PDF
What's New MySQL 8.0?
OracleMySQL
 
PDF
Percona Server 8.0
Laurynas Biveinis
 
PPTX
Why are we excited about MySQL 8? / Петр Зайцев (Percona)
Ontico
 
PDF
제3회난공불락 오픈소스 인프라세미나 - MySQL
Tommy Lee
 
PDF
Percona Live 2012PPT: MySQL Query optimization
mysqlops
 
PPTX
MySQL Tech Tour 2015 - 5.7 Whats new
Mark Swarbrick
 
PPTX
Mysql ecosystem in 2019
Alkin Tezuysal
 
PDF
MySQL Ecosystem in 2018
Laurynas Biveinis
 
PPTX
MySQL 8.0 Featured for Developers
Dave Stokes
 
PDF
MySQL 5.7 - What's new, How to upgrade and Document Store
Abel Flórez
 
PDF
介绍 Percona 服务器 XtraDB 和 Xtrabackup
YUCHENG HU
 
PPTX
Работа с индексами - лучшие практики для MySQL 5.6, Петр Зайцев (Percona)
Ontico
 
PDF
Developers' mDay 2017. - Bogdan Kecman Oracle
mCloud
 
PDF
Developers’ mDay u Banjoj Luci - Bogdan Kecman, Oracle – MySQL Server 8.0
mCloud
 
PDF
Learning MySQL 5.7
Jervin Real
 
PPTX
The latest with MySql on OpenStack Trove
Tesora
 
PDF
Percona Server for MySQL 8.0 @ Percona Live 2019
Laurynas Biveinis
 
PPTX
Mysql ecosystem in 2018
Alkin Tezuysal
 
PDF
My sql5.7 whatsnew_presentedatgids2015
Sanjay Manwani
 
PDF
MySQL Community Meetup in China : Innovation driven by the Community
Frederic Descamps
 
What's New MySQL 8.0?
OracleMySQL
 
Percona Server 8.0
Laurynas Biveinis
 
Why are we excited about MySQL 8? / Петр Зайцев (Percona)
Ontico
 
제3회난공불락 오픈소스 인프라세미나 - MySQL
Tommy Lee
 
Percona Live 2012PPT: MySQL Query optimization
mysqlops
 
MySQL Tech Tour 2015 - 5.7 Whats new
Mark Swarbrick
 
Mysql ecosystem in 2019
Alkin Tezuysal
 
MySQL Ecosystem in 2018
Laurynas Biveinis
 
MySQL 8.0 Featured for Developers
Dave Stokes
 
MySQL 5.7 - What's new, How to upgrade and Document Store
Abel Flórez
 
介绍 Percona 服务器 XtraDB 和 Xtrabackup
YUCHENG HU
 
Работа с индексами - лучшие практики для MySQL 5.6, Петр Зайцев (Percona)
Ontico
 
Developers' mDay 2017. - Bogdan Kecman Oracle
mCloud
 
Developers’ mDay u Banjoj Luci - Bogdan Kecman, Oracle – MySQL Server 8.0
mCloud
 
Learning MySQL 5.7
Jervin Real
 
The latest with MySql on OpenStack Trove
Tesora
 
Percona Server for MySQL 8.0 @ Percona Live 2019
Laurynas Biveinis
 
Mysql ecosystem in 2018
Alkin Tezuysal
 
My sql5.7 whatsnew_presentedatgids2015
Sanjay Manwani
 
MySQL Community Meetup in China : Innovation driven by the Community
Frederic Descamps
 
Ad

Recently uploaded (20)

PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PDF
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
PDF
Online Queue Management System for Public Service Offices in Nepal [Focused i...
Rishab Acharya
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PDF
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
PPTX
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
PDF
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PDF
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
PDF
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
PPTX
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PDF
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
Online Queue Management System for Public Service Offices in Nepal [Focused i...
Rishab Acharya
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
Tally software_Introduction_Presentation
AditiBansal54083
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
Ad

MySQL 5.7 in a Nutshell

  • 1. MySQL 5.7 in a Nutshell Alexander Rubin Principal Architect, Percona December 6, 2015
  • 2. www.percona.com About Me •  Working with MySQL for over 10 years –  Started at MySQL AB, then Sun Microsystems, –  then Oracle (MySQL Consulting) –  Joined Percona 2 years ago My name is Alexander Rubin https://www.linkedin.com/in/alexanderrubin
  • 3. www.percona.com Performance and Scalability –  Enhanced Speed: MySQL 5.7 delivered 1,600,000 queries per second (QPS) – 3x faster than MySQL 5.6. –  Optimized InnoDB: New capabilities include increased performance and concurrency –  More Robust Replication: •  multi-source replication •  enhanced Global Transaction Identifiers (GTIDs) •  improved multi-threaded slaves –  Enhanced Optimizer: A new dynamic cost model provides better query performance and greater user control. Agenda: New MySQL 5.7 features
  • 4. www.percona.com Manageability enhancements §  JSON Data Type and Calculated Fields: Allows for efficient and flexible storage, search, and manipulation of schema-less data. §  Performance Schema: Enables instrumentation for memory, transactions, stored routines, prepared statements, replication, and locks. §  MySQL SYS Schema: Provides helper objects that answer common performance, health, usage, and monitoring questions. §  Improved Security: Delivers easier and safer instance initialization, setup and management. §  Expanded Geographic Information System (GIS) Support: Spatial index support in InnoDB, GeoJSON, and GeoHash. Agenda: New MySQL 5.7 features
  • 5. www.percona.com MySQL 5.7 Performance Improvements Sysbench Becnhmark *Information from Oracle OpenWorld presentation by Geir Hoydalsvik Starts with 8 Threads What about 2-4 threads?
  • 6. www.percona.com MySQL 5.7: Single-threaded workload §  Multi-threaded workload looks great §  Single-threaded workload shows some regression https://bugs.mysql.com/bug.php?id=68825 http://smalldatum.blogspot.co.uk/2014/10/single-thread-performance-in-mysql-575.html
  • 7. www.percona.com MySQL 5.7: InnoDB, NoSQL With Memcached *Information from Oracle OpenWorld presentation by Geir Hoydalsvik
  • 8. www.percona.com Sysbench OLTP Read Write *Information from Oracle OpenWorld presentation by Geir Hoydalsvik
  • 9. www.percona.com InnoDB vs. MyISAM in v. 5.7 Feature MyISAM InnoDB Full Text Indexes yes Since MySQL 5.6 Portable tables (tablespaces) yes Since MySQL 5.6 Spatial Indexes/RTREE (GIS) yes Since MySQL 5.7 Last update for table yes Since MySQL 5.7 (http://dev.mysql.com/worklog/task/? id=6658) Suitable for temp tables yes Since MySQL 5.7 Also complex selects uses InnoDB ondisk temp tables Fast count(*) yes *Faster in MySQL 5.7 but does not store counter
  • 10. www.percona.com –  Performance: Buffer pool improvements –  Performance: Better Redo log handling and better index->lock handling –  Performance: DDL & Truncate improvements –  Performance: Temporary Table Optimizations –  Feature: Native Partitioning for InnoDB –  Feature: Dynamic buffer pool size re-size, more online alter table ops –  Feature: UNDO Log Space Management –  Feature: Transparent PageIO Compression –  Feature: GIS indexes –  Miscellaneous •  Implement update_time for InnoDB tables •  Improve select count(*) performance by using handler::records(); •  Improve recovery, redo log tablespace meta data changes InnoDB Improvements Overview
  • 11. www.percona.com InnoDB: Online Operations •  Resize the InnoDB Buffer Pool online •  More Online ALTER TABLE operations •  Enlarge VARCHAR, Rename Index •  More dynamic configuration variables •  New variables are dynamic •  Work to make existing variables dynamically settable
  • 12. www.percona.com §  May be useful in virtual enviroments where you can resize RAM online innodb_buffer_pool_chunk_size – resize done in chunk size §  Example: mysql>  SET  GLOBAL   innodb_buffer_pool_size=4*1024*1024*102 4;  -­‐-­‐  4G   http://dev.mysql.com/doc/refman/5.7/en/ innodb-­‐buffer-­‐pool-­‐online-­‐resize.html     Dynamic buffer pool re-size
  • 13. www.percona.com InnoDB - Bulk Load for Create Index •  Much faster INDEX creation and bulk loads •  Performance results show •  2-3x performance improvement for ADD/CREATE INDEX operations •  2-5% improvement for standard INSERT operations
  • 14. www.percona.com InnoDB Temporary Tables •  New separate tablespace for temporary tables •  Optimize DML operations •  No REDO logging, no change buffering, less locking •  InnoDB storage engine is used for on-disk internal temporary tables •  Complex select requiring ondisk temp tables will now use InnoDB by default (controlled by internal_tmp_disk_storage_engine variable) http://dev.mysql.com/doc/refman/5.7/en/server-system- variables.html#sysvar_internal_tmp_disk_storage_engine http://mysqlserverteam.com/mysql-5-7-innodb-intrinsic-tables/
  • 15. www.percona.com Transparent Page Compression •  Transparent Page Level Compression •  Happens transparently in background threads •  For supported Linux kernels and filesystems •  Uses sparse file and "hole punching" support •  Reduces IO Applies to all InnoDB data, including the system tablespace and UNDO logs But – many file systems do not support large number of "holes" well https://dev.mysql.com/doc/refman/5.7/en/innodb-page- compression.html
  • 16. www.percona.com GIS - InnoDB Spatial Indexes –  Full transactional support –  Only supports 2D data for now •  Use helper functions for distance calculations *Graphics from Oracle OpenWorld presentation by Geir Hoydalsvik
  • 17. www.percona.com •  GeoHash –  Quick lookups for exact matches –  Not very accurate for proximity searches •  GeoJSON •  Helper functions (ST_Distance_Sphere) GIS - Additional Features
  • 18. www.percona.com mysql>  SELECT  shape  into  @zip_shape  FROM  zcta.tl_2013_us_zcta510     WHERE  zcta5ce10='27701’;   Query  OK,  1  row  affected  (0.20  sec)     mysql>  SELECT  name,                  ST_Distance_Sphere(shape,  st_centroid(@zip_shape)  )  as  dist,                  ST_AsGeoJSON(shape)  as  GeoJSON,                ST_GeoHash(shape,  16)  as  GeoHash                FROM  points                  WHERE  ST_Within(shape,  @zip_shape)                  and  other_tags  like  '%"amenity"=>"cafe"%'  LIMIT  1G     ***************************  1.  row  ***************************        name:  Blue  Coffee  Cafe        dist:  374.9045320478079   GeoJSON:  {"type":  "Point",  "coordinates":  [-­‐78.9013567,  35.996332]}   GeoHash:  dnruu8cvc4sk26qz   1  row  in  set  (0.02  sec)       GIS - Example
  • 19. www.percona.com Generated (Virtual) Columns CREATE  TABLE  `ontime`  (      `id`  int(11)  NOT  NULL  AUTO_INCREMENT,      `YearD`  year(4)  NOT  NULL,      `FlightDate`  datetime  DEFAULT  NULL,      `Carrier`  char(2)  DEFAULT  NULL,      `OriginAirportID`  int(11)  DEFAULT  NULL,      `OriginCityName`  varchar(100)  DEFAULT  NULL,      `OriginState`  char(2)  DEFAULT  NULL,      `DestAirportID`  int(11)  DEFAULT  NULL,      `DestCityName`  varchar(100)  DEFAULT  NULL,      `DestState`  char(2)  DEFAULT  NULL,   ...   `Flight_dayofweek`  tinyint(4)     GENERATED  ALWAYS  AS  (dayofweek(FlightDate))  VIRTUAL,       PRIMARY  KEY  (`id`)   )  ENGINE=InnoDB;   alter  table  ontime  add  key  (Flight_dayofweek);     https://www.percona.com/blog/2015/04/29/generated-­‐virtual-­‐columns-­‐in-­‐ mysql-­‐5-­‐7-­‐labs/   https://dev.mysql.com/worklog/task/?id=8114   Does not store the column But INDEX it SELECT  Flight_dayofweek,  count(*)     FROM  ontime_sm_virtual       GROUP  BY  Flight_dayofweek  
  • 20. www.percona.com mysql>  EXPLAIN  SELECT  carrier,  count(*)                  FROM  ontime_sm_virtual                    WHERE  Flight_dayofweek  =  7  group  by  carrierG   ***************************  1.  row  ***************************                        id:  1      select_type:  SIMPLE                  table:  ontime_sm_virtual        partitions:  NULL                    type:  ref   possible_keys:  Flight_dayofweek                      key:  Flight_dayofweek              key_len:  2                      ref:  const                    rows:  165409            filtered:  100.00                  Extra:  Using  where;  Using  temporary;  Using  filesort   1  row  in  set,  1  warning  (0.00  sec)     Using index Generated (Virtual) Columns
  • 21. www.percona.com JSON Support mysql>  create  table  json_test  (   id  int  primary  key  auto_increment,     data  json   )  engine=InnoDB;   Query  OK,  0  rows  affected  (0.02  sec)       mysql>  select  *  from  json_test  where  data-­‐>'$.type'  =  'Point'  limit  1;   +-­‐-­‐-­‐-­‐+-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐+   |  id  |  data                                                                                                                |   +-­‐-­‐-­‐-­‐+-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐+   |    1  |  {"type":  "Point",  "coordinates":  [-­‐87.9101245,  41.7585879]}  |   +-­‐-­‐-­‐-­‐+-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐+             Same as JSON_EXTRACT(data,"$.type”)
  • 22. www.percona.com JSON Support: Indexes mysql>  explain  select  *  from  json_test  where  data-­‐>'$.type'  =  'Point'  limit  1G   ***************************  1.  row  ***************************                        id:  1      select_type:  SIMPLE                  table:  json_test        partitions:  NULL                    type:  ALL   possible_keys:  NULL                      key:  NULL              key_len:  NULL                      ref:  NULL                    rows:  996823            filtered:  100.00                  Extra:  Using  where     mysql>  alter  table  json_test     add  data_type  varchar(255)  GENERATED  ALWAYS  AS  (data-­‐>'$.type')  VIRTUAL;   Query  OK,  0  rows  affected  (0.00  sec)   Records:  0    Duplicates:  0    Warnings:  0     mysql>  alter  table  json_test  add  key  (data_type);   Query  OK,  0  rows  affected  (2.51  sec)   Records:  0    Duplicates:  0    Warnings:  0      
  • 23. www.percona.com JSON Support: Indexes mysql>  explain  select  *  from  json_test  where  data-­‐>'$.type'  =  'Point'  limit  1G   ***************************  1.  row  ***************************                        id:  1      select_type:  SIMPLE                  table:  json_test        partitions:  NULL                    type:  ref   possible_keys:  data_type                      key:  data_type              key_len:  258                      ref:  const                    rows:  1            filtered:  100.00                  Extra:  NULL          
  • 24. www.percona.com Replication Improvements Multi-Source Replication (slave can have multiple masters) Better Multi-Threaded Slaves (does not require multiple databases) Better GTID (online GTID deployment) Group Replication Plugin (virtual synchronous replication)
  • 25. www.percona.com MySQL Replication Topologies Master > Slave Masters > Slave (Multi-Source), Since 5.7 Master > Slaves Master > Slave > Slaves •  Now 1 replication slave can have many master servers! •  Important for BI/Data Science/Ad-hoc analytics
  • 26. www.percona.com MySQL 5.7: Optimizer Improvements •  UNION ALL queries no longer use temporary tables •  Improved optimizations for queries with IN expressions •  Improved optimizations for full-text queries •  More efficient sorting
  • 27. www.percona.com *************************** 1. row *************************** table: ontime_2012 key: covered ... Removed ... Extra: Using where; Using index *************************** 2. row *************************** table: ontime_2012 key: covered ... Removed ... Extra: Using where; Using index *************************** 3. row *************************** id: NULL select_type: UNION RESULT table: <union1,2> type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: NULL Extra: Using temporary Temporary Table for UNION ALL 5.6: Will create temp table (as shown) 5.7: Do not materialize in temporary tables (unless used for sorting) rows are sent directly to client 5.7: Client will receive the first row faster 5.7: Less memory and disk consumption
  • 28. www.percona.com Optimizations for IN Expressions •  MySQL 5.7: IN queries with row value expressions executed using range scans. •  Imagine that you got list of IDs from Full Text Search solution (solr/ elasticsearch/sphinx) •  Now I need to get the actual documents     mysql>  select  name,  other_tags  from  poi_info       WHERE  osm_id  in  (367909272,  367841688,  493001986,  ...);    
  • 29. www.percona.com Performance Schema improvements Memory Instrumentations –  Memory used (bytes) –  Operation counts –  Type of memory used (caches, internal buffers, etc) Statement Instrumentations –  Stored Procedures –  Stored Functions –  Prepared Statements –  Transactions Other Instrumentation –  Replication slave status –  MDL lock instrumentation –  User variables per thread –  Server stage tracking –  Track long running SQL
  • 30. www.percona.com SYS Schema Included in MySQL 5.7 Get the memory usage per user with SYS schema:         mysql>  update   performance_schema.setup_instruments     set  enabled='YES',  timed='YES'     where  name  like  'memory/%';   Query  OK,  375  rows  affected  (0.00  sec)   Rows  matched:  375    Changed:  375     Warnings:  0       mysql>  select  *  from   sys.memory_global_totalG   ***************************  1.  row   ***************************   total_allocated:  90.20  MiB   1  row  in  set  (0.01  sec)     mysql>  select  *  from   sys.memory_by_user_by_current_bytesG   ***************************  1.  row   ***************************                              user:  root   current_count_used:  42    current_allocated:  361.03  KiB    current_avg_alloc:  8.60  KiB    current_max_alloc:  248.04  KiB        total_allocated:  46.34  GiB   ***************************  2.  row   ***************************                              user:  background   current_count_used:  0    current_allocated:  0  bytes    current_avg_alloc:  0  bytes    current_max_alloc:  0  bytes        total_allocated:  14.72  KiB   2  rows  in  set  (0.01  sec)  
  • 31. www.percona.com Improved MDL locking •  Removes bottlenecks around DML access to a single table •  10% increased throughput in OLTP_RO/ POINT_SELECT sysbench •  Optimized for typical DML heavy workloads http://www.chriscalender.com/troubleshooting-waiting-for-table-metadata-lock-errors- for-both-myisam-and-innodb-tables/
  • 32. www.percona.com Security - Encryption, Passwords, Installation •  Deployment: enable secure unattended install by default •  Random password set on install •  Removed anonymous accounts •  Deployment without test account, schema, demo files •  AES 256 Encryption •  Password rotation policies •  Can be set globally, and at the user level
  • 33. www.percona.com Explain on a Running Query mysql>  show  processlistG   ...            Id:  8   Command:  Query        Time:  90      State:  Sending  data        Info:  select  count(*),  osm_id  from  points_new  group  by  osm_id     mysql>  explain  for  connection  8G     ***************************  1.  row  ***************************                        id:  1      select_type:  SIMPLE                  table:  points_new        partitions:  NULL                    type:  ALL   possible_keys:  NULL                      key:  NULL              key_len:  NULL                      ref:  NULL                    rows:  11368798            filtered:  100.00                  Extra:  Using  temporary;  Using  filesort     Shows query plan on connection <id> Applicable for SELECT/INSERT/ DELETE/UPDATE
  • 34. www.percona.com New Data Dictionary, New Tablespace Management (future) •  SaaS case: 50K databases inside single instance •  ~ 1M tables = 2M files inside MySQL datadir •  InnoDB tables replace .frm, .trg, .trn, .par files •  Ability to create 1 tablespace for multiple tables
  • 35. www.percona.com FAQ Q: Do you recommend upgrading to 5.7 right now? A: As with all upgrades to a newer version it should be tested. You can expect to see bugs. Upgrade non-critical replication slaves first (i.e. reporting slaves) Use pt-upgrade to test for any regressions (https://www.percona.com/doc/percona-toolkit/2.2/pt-upgrade.html) Q: When Percona Server 5.7 will be released as GA? A: We expect to have a release around the end of January 2016 Please note that this date is approximate as there is always high risk of a large amount of bugs to be discovered following a major release.
  • 36. www.percona.com Special Thanks Mike Frank - Senior Product Manager, Oracle Geir Høydalsvik - Software Development Director, Oracle Presented “What’s New in MySQL 5.7” Sunny Bains - Senior Engineering Manager, Oracle Presented “MySQL 5.7: InnoDB—What’s New” Mark Leith – Senior Software Development Manager, Oracle Developer of SYS Schema Chris Calender - Principal Support Engineer for MariaDB Great blog posts explaining metadata locking http://www.chriscalender.com/tracking-metadata-locks-mdl-in-mysql-5-7/ All Oracle MySQL Developers for the great MySQL 5.7 release!