Databases 7 min read

Key New Features of MySQL 8.0 for Relational Databases

MySQL 8.0 introduces several relational‑database enhancements, including invisible indexes for performance tuning, persistent configuration via SET PERSIST, default utf8mb4 character set, support for Common Table Expressions, and window functions, each illustrated with practical SQL examples.

IT Xianyu
IT Xianyu
IT Xianyu
Key New Features of MySQL 8.0 for Relational Databases

This article outlines the main new features of MySQL 8.0 that affect relational database usage.

1. Invisible Indexes

MySQL 8.0 allows indexes to be marked as INVISIBLE so the optimizer will ignore them, which is useful for performance debugging. You can hide an index, observe the impact on query performance, and then either make it visible again or drop it if it proves unnecessary.

Hide an index:

ALTER TABLE t ALTER INDEX i INVISIBLE;

Make the index visible again:

ALTER TABLE t ALTER INDEX i VISIBLE;

When an index is invisible, the SHOW INDEX output shows Visible as NO .

Note: Hidden indexes are still maintained in real time; keeping them hidden for a long time is usually not advisable because they still affect insert, update, and delete performance.

2. Persistent Settings

Runtime changes made with SET GLOBAL are temporary. MySQL 8.0 adds SET PERSIST to write configuration changes permanently to mysqld-auto.cnf , which is read on the next server start.

Example:

SET PERSIST max_connections = 500;

3. UTF-8 Encoding

The default character set in MySQL 8.0 is now utf8mb4 , which fully supports all Unicode emoji characters, eliminating the need to manually change the default from latin.

4. Common Table Expressions (CTE)

Complex queries that previously required nested sub‑queries can now use CTEs for clearer structure.

Without CTE:

SELECT t1.*, t2.* FROM (SELECT col1 FROM table1) t1, (SELECT col2 FROM table2) t2;

With CTE:

WITH t1 AS (SELECT col1 FROM table1),
     t2 AS (SELECT col2 FROM table2)
SELECT t1.*, t2.* FROM t1, t2;

5. Window Functions

MySQL 8.0 adds window functions, enabling ranking and analytical calculations without requiring GROUP BY . For example, ranking class sizes:

SELECT *, rank() OVER w AS `rank`
FROM classes
WINDOW w AS (ORDER BY stu_count);

Summing values across rows:

SELECT *, sum(stu_count) OVER () AS total_count
FROM classes;

Calculating each class's proportion of the total:

SELECT *,
       (stu_count) / (sum(stu_count) OVER ()) AS rate
FROM classes;

These enhancements make MySQL 8.0 more user‑friendly and powerful for modern database development.

SQLDatabaseMySQLIndexeswindow functionscte8.0
IT Xianyu
Written by

IT Xianyu

We share common IT technologies (Java, Web, SQL, etc.) and practical applications of emerging software development techniques. New articles are posted daily. Follow IT Xianyu to stay ahead in tech. The IT Xianyu series is being regularly updated.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.