MySql DeepDive
MySql DeepDive
6
http://dev.mysql.com/doc/refman/5.6/en/mysql-nutshell.html
Krishan Kumar
February 1, 2014
Yahoo! Confidential 1
Agenda
Covering following topics: Undo logs
Partitioning Online DDL
Replication
Optimizer Improved tablespace management
Misc
Q&A
Yahoo! Confidential 2
1. Undo logs
Move InnoDB undo logs out of System tablespace. Now you can store them on high speed disks like SSDs. Two new variables has been added to achieve this:
innodb_undo_directory: dir path to store undo files innodb_undo_tablespaces: default 0 max value upto 126 innodb_undo_logs: Number of rollback segments can be used by a transaction, max value 128
Yahoo! Confidential
To move undo logs out of System Tablespace you need to recreate db.
2. Partitioning
You can have max 8192 partition or subpartiton in a table. You can Exchange partition or subpartitions. Explicit selection of one or more partition or subpartition supported . Supports Select, Delete, Insert, Replace, Update, Load Data, Load XML
Partition lock pruning MyISAM tables i.e. now only those partitions will be locked which are affected by query.
4
Yahoo! Confidential
3. Online DDL
Without impacting insert, updates and deletes or without copying table. Lets you decide performance and concurrency during DDL
In-place update where as possible instead of creating new copy of tables or blocking DML.
Create index is completely online now but except FULLTEXT ALGORITHM & LOCK is important option which can be specified with Alter tables statement.
Yahoo! Confidential 5
4. Replication
Delayed replication is supported, use master_delay with change master, default value 0
CHANGE MASTER TO with MASTER_DELAY=5 time in seconds.
Added couple of new parameters with SHOW SLAVE STATUS\G like Master_Log_File, SQL_Delay, Master_Retry_Count etc
Yahoo! Confidential 6
Contnd
Supports transaction based replication using GTIDs (Global Transaction IDs)
Unique identifier associated with each transaction and unique on all servers in replication setup GTID = source_id:transaction_id where source_id: Servers server_uuid & transaction_id: Sequence number determined by in which transcations are commited. Start server --gtid_mode=ON --log-bin --log-slaveupdates --enforce-gtid-consistency Use MASTER_AUTO_POSITION in place of MASTER_LOG_FILE or MASTER_LOG_POS when setting up slave
Yahoo! Confidential 7
5. Optimizer
EXPLAIN now supports delete, insert, replace and update statements Efficiently handles subqueries in FROM clause
SELECT ... FROM single_table ... ORDER BY non_index_column [DESC] LIMIT [M,]N; Use sort_buffer_size if m+n can fit into memory, server can avoid merge sort and usage sort buffer as priority queue
EXPLAIN does not executes subqueries to show explain plan for a query
explain select * from (select * from perf_fact_daily_2013_12_10 where publisher_id=4) kk;
In 5.5: 2 rows in set (1 min 51.00 sec), In 5.6: 2 rows in set (0.00 sec)
Yahoo! Confidential
Contnd
Index Condition Pushdown (ICP):
Get next rowss index tuple
Check WHERE condition, check using index columns, if not satisfied then go to next row in index If condition satisfied then use index tuple to locate record in table
Yahoo! Confidential
Advantage: reclaiming of free space, truncate table on individual .idb files runs much faster, you can individually copy from one MySQL instance to other instance like Transportable tablespace
Yahoo! Confidential 10
7. Misc
Mysql.user table has password_expire column
Strong encryption for user account password through plug-in sha256_password that implements SHA-256
Provision for checking password security using validate_password_strength(str) Several new InnoDB-related INFORMATION_SCHEMA tables provide information about the InnoDB buffer pool, metadata about tables, indexes and foreign keys from the InnoDB data dictionary MySQL now permits fractional seconds for TIME, DATETIME, and TIMESTAMP values
Yahoo! Confidential 11
Contnd
No restriction on having automatically initialized or updated to the current date and time for TIMESTAMP column per table. Any TIMESTAMP column definition can have any combination of DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP clauses YEAR(2) deprecated, it gets converted to YEAR(4) in new table or altered tables. Existing tables remains as it is but certain programs convert it automatically like Alter table, Repair Table, dumping data by mysqldum then reloading Many more ..
Yahoo! Confidential 12
Q&A
Questions???
Yahoo! Confidential 13