Book Image

MySQL 8 Administrator???s Guide

By : Chintan Mehta, Ankit K Bhavsar, Hetal Oza, Subhash Shah
Book Image

MySQL 8 Administrator???s Guide

By: Chintan Mehta, Ankit K Bhavsar, Hetal Oza, Subhash Shah

Overview of this book

MySQL is one of the most popular and widely used relational databases in the world today. The recently released version 8.0 brings along some major advancements in the way your MySQL solution can be administered. This handbook will be your companion to understand the newly introduced features in MySQL and show you how you can leverage them to design a high-performance MySQL solution for your organization. This book starts with a brief introduction to the new features in MySQL 8, and then quickly jumping onto the crucial administration topics that you will find useful in your day-to-day work. Topics such as migrating to MySQL 8, MySQL benchmarking, achieving high performance by implementing the indexing techniques, and optimizing your queries are covered in this book. You will also learn how to perform replication, scale your MySQL solution and implement effective security techniques. There is also a special section on the common and not so common troubleshooting techniques for effective MySQL administration is also covered in this book. By the end of this highly practical book, you will have all the knowledge you need to tackle any problem you might encounter while administering your MySQL solution.
Table of Contents (17 chapters)

Index extension

Index extension is the feature by which MySQL 8 extends a secondary index by appending the primary key. The InnoDB engine automatically extends a secondary index if it is required. To control the behavior of index extensions, MySQL 8 has defined a use_index_extensions flag in the optimizer_switch system variable. By default, this option is enabled, but the user is allowed to change it at runtime by using the following command:

SET optimizer_switch = 'use_index_extensions=off';

Let's look at one example to understand the index extension in detail. Let's create a table and insert the following values:

CREATE TABLE table1 (
c1 INT NOT NULL DEFAULT 0,
c2 INT NOT NULL DEFAULT 0,
d1 DATE DEFAULT NULL,
PRIMARY KEY (c1, c2),
INDEX key1 (d1)
) ENGINE = InnoDB;

--Insert values into table
INSERT INTO table1 VALUES
(1, 1, '1990-01-01'), (1, 2, &apos...