Bootstrap

Mysql中解释Explain 详解

前言

Github:https://github.com/HealerJean

博客:http://blog.healerjean.com

数据准备

mysql优化器在数据量不同的情况下,也会到结果产生影响

create table `user`
(
    `id`    bigint(20) unsigned not null auto_increment,
    `name`  varchar(64)         default null,
    `age`   bigint(20) unsigned default '0',
    `param` varchar(32)         default null,
    `a`     int(11)             default '0',
    `b`     int(11)             default '0',
    `c`     int(11)             default '0',
    primary key (`id`),
    key `idx_a_b_c_d` (`a`, `b`, `c`),
    key `idx_age` (`age`),
    key `idx_name` (`name`)
);



create table `order_info`
(
    `id`          bigint(16) unsigned not null auto_increment,
    `ref_user_id` bigint(20) unsigned not null,
    `serial_no`   varchar(32)         not null,
    primary key (`id`),
    key `uk_user_id` (`ref_user_id`)
);




INSERT INTO hlj_sql.user (id, name, age, param, a, b, c) VALUES 
;