Beta Draft: 2017-03-24
This section summarizes what has been added to, deprecated in, and removed from MySQL 8.0. A companion section lists MySQL server options and variables that have been added, deprecated, or removed in MySQL 8.0. See Section 1.5, “Server and Status Variables and Options Added, Deprecated, or Removed in MySQL 8.0”.
The following features have been added to MySQL 8.0:
Data dictionary. These enhancements were added:
MySQL Server now incorporates a transactional data dictionary that stores information about database objects. In previous MySQL releases, dictionary data was stored in metadata files and nontransactional tables.
InnoDBcontinues to use its own data dictionary in the MySQL 8.0.0 release.
For more information about this feature, see Chapter 15, MySQL Data Dictionary.
Account management. MySQL now supports roles, which are named collections of privileges. Roles can be created and dropped. Roles can have privileges granted to and revoked from them. Roles can be granted to and revoked from user accounts. The active applicable roles for an account can be selected from among those granted to the account, and can be changed during sessions for that account. For more information, see Section 7.3.4, “Using Roles”.
InnoDB enhancements. These
InnoDBenhancements were added:
The current maximum auto-increment counter value is written to the redo log each time the value changes, and it is saved to an engine-private system table on each checkpoint. These changes make the current maximum auto-increment counter value persistent across server restarts. Additionally:
A server restart no longer cancels the effect of the
AUTO_INCREMENT = Ntable option. If you initialize the auto-increment counter to a specific value, or if you alter the auto-increment counter value to a larger value, the new value is persisted across server restarts.
A server restart immediately following a
ROLLBACKoperation no longer results in the reuse of auto-increment values that were allocated to the rolled-back transaction.
If you modify an
AUTO_INCREMENTcolumn value to a value larger than the current maximum auto-increment value (in an
UPDATEoperation, for example), the new value is persisted, and subsequent
INSERToperations allocate auto-increment values starting from the new, larger value.
For more information, see Section 16.8.5, “AUTO_INCREMENT Handling in InnoDB”, and InnoDB AUTO_INCREMENT Counter Initialization.
When encountering index tree corruption,
InnoDBwrites a corruption flag to the redo log, which makes the corruption flag crash-safe.
InnoDBalso writes in-memory corruption flag data to an engine-private system table on each checkpoint. During recovery,
InnoDBreads corruption flags from both locations and merges results before marking in-memory table and index objects as corrupt.
InnoDBmemcached plugin supports multiple
getoperations (fetching multiple key/value pairs in a single memcached query) and range queries. See Section 16.19.4, “InnoDB memcached Multiple get and Range Query Support”.
A new dynamic configuration option,
innodb_deadlock_detect, is used to disable deadlock detection. On high concurrency systems, deadlock detection can cause a slowdown when numerous threads wait for the same lock. At times, it may be more efficient to disable deadlock detection and rely on the
innodb_lock_wait_timeoutsetting for transaction rollback when a deadlock occurs.
INNODB_CACHED_INDEXES, reports the number of index pages cached in the
InnoDBbuffer pool for each index.
InnoDBtemporary tables are created in the shared temporary tablespace,
As of MySQL 8.0.1,
SKIP LOCKEDoptions with
SELECT ... FOR SHAREand
SELECT ... FOR UPDATElocking read statements.
NOWAITcauses the statement to return immediately if a requested row is locked by another transaction.
SKIP LOCKEDremoves locked rows from the result set. See Locking Read Concurrency with NOWAIT and SKIP LOCKED.
SELECT ... FOR SHAREreplaces
SELECT ... LOCK IN SHARE MODE, but
LOCK IN SHARE MODEremains available for backward compatibility. The statements are equivalent. However,
SKIP LOCKED, and
OFoptions. See Section 14.2.9, “SELECT Syntax”.
OFapplies locking queries to named tables.
JSON enhancements. The following enhancements or additions were made to MySQL's JSON functionality:
This is a refinement of the column path operator
->introduced in MySQL 5.7;
col->>"$.path"is equivalent to
JSON_UNQUOTE(col->"$.path"). The inline path operator can be used wherever you can use
GROUP BYclauses. For more information, see the description of the operator, as well as Section 13.16.7, “JSON Path Syntax”.
This operator is implemented in MySQL 8.0.0.
Added two JSON aggregation functions
JSON_ARRAYAGG()takes a column or expression as its argument, and aggregates the result as a single
JSONarray. The expression can evaluate to any MySQL data type; this does not have to be a
JSON_OBJECTAGG()takes two columns or expressions which it interprets as a key and a value; it returns the result as a single
JSONobject. For more information and examples, see Section 13.18, “Aggregate (GROUP BY) Functions”.
These functions are available beginning with MySQL 8.0.1.
Added the JSON utility function
JSON_PRETTY(), which outputs an existing
JSONvalue in an easy-to-read format; each JSON object member or array value is printed on a separate line, and a child object or array is intended 2 spaces with respect to its parent.
This function also works with a string that can be parsed as a JSON value.
For more detailed information and examples, see Section 13.16.2, “Functions That Create JSON Values”.
JSON_PRETTY()is available beginning with MySQL 8.0.1.
JSONvalues in a query using
ORDER BY, each value is now represented by a variable-length part of the sort key, rather than a part of a fixed 1K in size. In many cases this can reduce excessive usage; for example, a scalar
BIGINTvalue actually requires very few bytes, so that the remainder of this space (up to 90% or more) was taken up by padding. This change has the following benefits for performance:
Sort buffer space is now used more effectively, so that filesorts need not flush to disk as early or often as with fixed-length sort keys. This means that more data can be sorted in memory, avoiding unnecessary disk access.
Shorter keys can be compared more quickly than longer ones, providing a noticeable improvement in performance. This is true for sorts performed entirely in memory as well as for sorts that require writing to and reading from disk.
This improvmeent for JSON sort keys was implemented in MySQL 8.0.1.
Optimizer. These optimizer enhancements were added:
MySQL now supports invisible indexes. An invisible index is not used by the optimizer at all, but is otherwise maintained normally. Indexes are visible by default. Invisible indexes make it possible to test the effect of removing an index on query performance, without making a destructive change that must be undone should the index turn out to be required. See Section 9.3.11, “Invisible Indexes”.
MySQL now supports descending indexes:
DESCin an index definition is no longer ignored but causes storage of key values in descending order. Previously, indexes could be scanned in reverse order but at a performance penalty. A descending index can be scanned in forward order, which is more efficient. Descending indexes also make it possible for the optimizer to use multiple-column indexes when the most efficient scan order mixes ascending order for some columns and descending order for others. See Section 9.3.12, “Descending Indexes”.
Common table expressions. MySQL now supports common table expressions, both nonrecursive and recursive. Common table expressions enable use of named temporary result sets, implemented by permitting a
SELECTstatements and certain other statements. For more information, see Section 14.2.12, “WITH Syntax (Common Table Expressions)”.
The following features are deprecated in MySQL 8.0 and may be or will be removed in a future series. Where alternatives are shown, applications should be updated to use them.
The following items are obsolete and have been removed in MySQL 8.0. Where alternatives are shown, applications should be updated to use them.
The data dictionary provides information about database objects, so the server no longer checks directory names in the data directory to find databases. Consequently, the
ignore_db_dirssystem variables are extraneous and have been removed.
sync_frmsystem variable has been removed because
.frmfiles have become obsolete.
In MySQL 5.7, several spatial functions available under multiple names were deprecated to move in the direction of making the spatial function namespace more consistent, the goal being that each spatial function name begin with
ST_if it performs an exact operation, or with
MBRif it performs an operation based on minimum bounding rectangles. In MySQL 8.0, the deprecated functions are removed to leave only the corresponding
These functions are removed in favor of the
These functions are removed in favor of the
GLength()is removed in favor of
The functions described in Section 13.15.4, “Functions That Create Geometry Values from WKB Values” previously accepted either WKB strings or geometry arguments. Geometry arguments are no longer permitted and produce an error. See that section for guidelines for migrating queries away from using geometry arguments.
The parser no longer treats
\Nas a synonym for
NULLin SQL statements. Use
This change does not affect text file import or export operations performed with
LOAD DATA INFILEor
SELECT ... INTO OUTFILE, for which
NULLcontinues to be represented by
\N. See Section 14.2.6, “LOAD DATA INFILE Syntax”.
PROCEDURE ANALYSE()syntax is removed.
--ssl-verify-server-certoptions have been removed. Use
--ssl-verify-server-certoptions. (The server-side
--ssloption remains unchanged.)
For the C API,
mysql_options()correspond to the client-side
--ssl-verify-server-certoptions and have been removed. Use
MYSQL_OPT_SSL_MODEwith an option value of
--temp-poolserver option has been removed.
The server no longer performs conversion of pre-MySQL 5.1 database names containing special characters to 5.1 format with the addition of a
#mysql50#prefix. Because these conversions are no longer performed, the
--fix-table-namesoptions for mysqlcheck, the
UPGRADE DATA DIRECTORY NAMEclause for the
ALTER DATABASEstatement, and the
Com_alter_db_upgradestatus variable have been removed.
Upgrades are supported only from one major version to another (for example, 5.0 to 5.1, or 5.1 to 5.5), so there should be little remaining need for conversion of older 5.0 database names to current versions of MySQL. As a workaround, upgrade a MySQL 5.0 installation to MySQL 5.1 before upgrading to a more recent release.
The mysql_install_db program has been removed from MySQL distributions. Data directory initialization should be performed by invoking mysqld with the
--initialize-insecureoption instead. In addition, the
--bootstrapoption for mysqld that was used by mysql_install_db has been removed, and the
CMakeoption that controlled the installation location for mysql_install_db has been removed.
The generic partitioning handler has been removed from the MySQL server. In order to support partitioning of a given table, the storage engine used for the table must now provide its own (“native”) partitioning handler. The
--skip-partitionoptions have been removed from the MySQL Server, and partitioning-related entries are no longer shown in the output of
SHOW PLUGINSor in the
Two MySQL storage engines currently provide native partitioning support—
NDB; of these, only
InnoDBis supported in MySQL 8.0. Any attempt to create partitioned tables in MySQL 8.0 using any other storage engine fails.
Ramifications for upgrades. The direct upgrade of a partitioned table using a storage engine other than
MyISAM) from MySQL 5.7 (or earlier) to MySQL 8.0 is not supported. There are two options for handling such a table:
At least one of the two operations just listed must be performed for each partitioned non-
InnoDBtable prior to upgrading the server to MySQL 8.0. Otherwise, such a table cannot be used following the upgrade.
Due to the fact that table creation statements that would result in a partitioned table using a storage engine without partitioning support now fail with an error (ER_CHECK_NOT_IMPLEMENTED), you must make sure that any statements in a dump file (such as that written by mysqldump) from an older version of MySQL that you wish to import into a MySQL 8.0 server that create partitioned tables do not also specify a storage engine such as
MyISAMthat has no native partitioning handler. You can do this by performing either of the following:
Remove any references to partitioning from
CREATE TABLEstatements that use a value for the
STORAGE ENGINEoption other than
Specifying the storage engine as
InnoDB, or allow
InnoDBto be used as the table's storage engine by default.
For more information, see Section 20.6.2, “Partitioning Limitations Relating to Storage Engines”.
System and status variable information is no longer maintained in the
INFORMATION_SCHEMA. These tables have been removed:
SESSION_STATUS. Use the corresponding Performance Schema tables instead. See Section 23.10.13, “Performance Schema System Variable Tables”, and Section 23.10.14, “Performance Schema Status Variable Tables”. In addition, the
show_compatibility_56system variable has been removed. It was used in the transition period during which system and status variable information in
INFORMATION_SCHEMAtables was moved to Performance Schema tables, and is no longer needed. These status variables have been removed:
Slave_running. The information they provided is available in Performance Schema tables; see Migrating to Performance Schema System and Status Variable Tables.
libmysqldembedded server library has been removed, along with:
The (undocumented) mysql
The mysqltest_embedded and mysql_client_test_embedded test programs
The mysql_plugin utility has been removed. Alternatives include loading plugins at server startup using the
--plugin-load-addoption, or at runtime using the
The following server error codes are not used and have been removed. Applications that test specifically for any of these errors should be updated.
ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE ER_BINLOG_ROW_RBR_TO_SBR ER_BINLOG_ROW_WRONG_TABLE_DEF ER_CANT_ACTIVATE_LOG ER_CANT_CHANGE_GTID_NEXT_IN_TRANSACTION ER_CANT_CREATE_FEDERATED_TABLE ER_CANT_CREATE_SROUTINE ER_CANT_DELETE_FILE ER_CANT_GET_WD ER_CANT_SET_GTID_PURGED_WHEN_GTID_MODE_IS_OFF ER_CANT_SET_WD ER_CANT_WRITE_LOCK_LOG_TABLE ER_CREATE_DB_WITH_READ_LOCK ER_CYCLIC_REFERENCE ER_DB_DROP_DELETE ER_DELAYED_NOT_SUPPORTED ER_DIFF_GROUPS_PROC ER_DISK_FULL ER_DROP_DB_WITH_READ_LOCK ER_DROP_USER ER_DUMP_NOT_IMPLEMENTED ER_ERROR_DURING_CHECKPOINT ER_ERROR_ON_CLOSE ER_EVENTS_DB_ERROR ER_EVENT_CANNOT_DELETE ER_EVENT_CANT_ALTER ER_EVENT_COMPILE_ERROR ER_EVENT_DATA_TOO_LONG ER_EVENT_DROP_FAILED ER_EVENT_MODIFY_QUEUE_ERROR ER_EVENT_NEITHER_M_EXPR_NOR_M_AT ER_EVENT_OPEN_TABLE_FAILED ER_EVENT_STORE_FAILED ER_EXEC_STMT_WITH_OPEN_CURSOR ER_FAILED_ROUTINE_BREAK_BINLOG ER_FLUSH_MASTER_BINLOG_CLOSED ER_FORM_NOT_FOUND ER_FOUND_GTID_EVENT_WHEN_GTID_MODE_IS_OFF__UNUSED ER_FRM_UNKNOWN_TYPE ER_GOT_SIGNAL ER_GRANT_PLUGIN_USER_EXISTS ER_GTID_MODE_REQUIRES_BINLOG ER_GTID_NEXT_IS_NOT_IN_GTID_NEXT_LIST ER_HASHCHK ER_INDEX_REBUILD ER_INNODB_NO_FT_USES_PARSER ER_LIST_OF_FIELDS_ONLY_IN_HASH_ERROR ER_LOAD_DATA_INVALID_COLUMN_UNUSED ER_LOGGING_PROHIBIT_CHANGING_OF ER_MALFORMED_DEFINER ER_MASTER_KEY_ROTATION_ERROR_BY_SE ER_NDB_CANT_SWITCH_BINLOG_FORMAT ER_NEVER_USED ER_NISAMCHK ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR ER_NO_FILE_MAPPING ER_NO_GROUP_FOR_PROC ER_NO_RAID_COMPILED ER_NO_SUCH_KEY_VALUE ER_NO_SUCH_PARTITION__UNUSED ER_OBSOLETE_CANNOT_LOAD_FROM_TABLE ER_OBSOLETE_COL_COUNT_DOESNT_MATCH_CORRUPTED ER_ORDER_WITH_PROC ER_PARTITION_SUBPARTITION_ERROR ER_PARTITION_SUBPART_MIX_ERROR ER_PART_STATE_ERROR ER_PASSWD_LENGTH ER_QUERY_ON_MASTER ER_RBR_NOT_AVAILABLE ER_SKIPPING_LOGGED_TRANSACTION ER_SLAVE_CHANNEL_DELETE ER_SLAVE_MULTIPLE_CHANNELS_HOST_PORT ER_SLAVE_MUST_STOP ER_SLAVE_WAS_NOT_RUNNING ER_SLAVE_WAS_RUNNING ER_SP_GOTO_IN_HNDLR ER_SP_PROC_TABLE_CORRUPT ER_SQL_MODE_NO_EFFECT ER_SR_INVALID_CREATION_CTX ER_TABLE_NEEDS_UPG_PART ER_TOO_MUCH_AUTO_TIMESTAMP_COLS ER_UNEXPECTED_EOF ER_UNION_TABLES_IN_DIFFERENT_DIR ER_UNSUPPORTED_BY_REPLICATION_THREAD ER_UNUSED1 ER_UNUSED2 ER_UNUSED3 ER_UNUSED4 ER_UNUSED5 ER_UNUSED6 ER_VIEW_SELECT_DERIVED_UNUSED ER_WRONG_MAGIC ER_WSAS_FAILED
In MySQL 5.7, the
LOCK_TABLEcolumn in the
INNODB_LOCKStable and the
locked_tablecolumn in the
x$innodb_lock_waitsviews contain combined schema/table name values. In MySQL 8.0, the
data_lockstable and the
sysschema views contain separate schema name and table name columns. See Section 220.127.116.11, “The innodb_lock_waits and x$innodb_lock_waits Views”.
InnoDBno longer supports compressed temporary tables. When
innodb_strict_modeis enabled (the default),
CREATE TEMPORARY TABLEreturns an error if
KEY_BLOCK_SIZEis specified. If
innodb_strict_modeis disabled, warnings are issued and the temporary table is created using a non-compressed row format.
InnoDBno longer creates
InnoDBSymbolic Link files) when creating tablespace data files outside of the MySQL data directory. Redo log records are now used to locate remote tablespaces.
With this change, moving a remote tablespace while the server is offline by manually modifying an
.islfile is no longer supported.
InnoDBfile format configuration parameters were removed:
File format configuration parameters were necessary for creating tables compatible with earlier versions of
InnoDBin MySQL 5.1. Now that MySQL 5.1 has reached the end of its product lifecycle, the parameters are no longer required.
innodb_support_xasystem variable, which enables support for two-phase commit in XA transactions, was removed.
InnoDBsupport for two-phase commit in XA transactions is always enabled.
Support for DTrace has been removed.