MySQL execution plan explain and index data structure deduction
mysql tutorialThe column introduces the execution plan explain and index data structure Preparation First build the database table, the MySQL table for demonstration, and the table creation statement: CREATE TABLE `emp` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key', `empno` int(11) DEFAULT NULL COMMENT ' ;employee number’, `ename` varchar(255) DEFAULT NULL COMMENT ’employee’s name’, `job` varchar(255) DEFAULT NULL COMMENT ‘job’, `mgr` varchar(255) DEFAULT NULL COMMENT & # 39; manager’s job number & # 39;, `hiredate` date DEFAULT NULL COMMENT & # 39; hire date & # 39;, `sal` double DEFAULT NULL COMMENT ' 39; Salary & # 39;, `comm` double DEFAULT NULL COMMENT & # 39; Allowance & # 39;, `deptno` int(11) DEFAULT NULL COMMENT & # 39; department number & # 39;, PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='employee table';CREATE TABLE `dept` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key', `deptno `int(11) DEFAULT NULL COMMENT 'department number', `dname` varchar(255) DEFAULT NULL COMMENT 'department name', `loc` varchar(255) DEFAULT NULL COMMENT ‘Address’, PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Department table';CREATE TABLE `salgrade` ( `id` int(11) NOT NULL COMMENT 'primary key', `grade` varchar(255) DEFAULT NULL COMMENT 'grade', `lowsal` varchar(255) DEFAULT NULL COMMENT 'minimum wage',…