qkl_librarys;
+--------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+--------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| qkl_librarys | 0 | PRIMARY | 1 | id | A | 39747 | NULL | NULL | | BTREE | |
+--------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------++--------------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+---------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| title | varchar(100) | NO | | NULL | |
| en_title | varchar(100) | YES | | NULL | |
| lasttime | int(11) | YES | | NULL | |
+--------------+---------------+------+-----+---------+----------------+
、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
+----------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+---------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| mid | int(11) | NO | | NULL | |
| thunder | text | YES | | NULL | |
+----------+---------+------+-----+---------+----------------++--------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+--------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| qkl_libdowns | 0 | PRIMARY | 1 | id | A | 39747 | NULL | NULL | | BTREE | |
+--------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
+-------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+-------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| qkl_libmore | 0 | PRIMARY | 1 | id | A | 31264 | NULL | NULL | | BTREE | |
+-------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------++--------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| mid | int(11) | NO | | NULL | |
| push | tinyint(4) | YES | | NULL | |
+--------------+--------------+------+-----+---------+----------------+数据大概都是没表3W条
执行三表联查 因为需要3个联合数据 所以就是直接三表sql:select * from qkl_librarys a,qkl_libdowns b,qkl_libmore c where a.id=b.mid and a.id=c.mid and a.push=1 order by lasttime desc limit 10;
执行大概要1分钟多才可以读取10条 求大神给分析
+--------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+--------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| qkl_librarys | 0 | PRIMARY | 1 | id | A | 39747 | NULL | NULL | | BTREE | |
+--------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------++--------------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+---------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| title | varchar(100) | NO | | NULL | |
| en_title | varchar(100) | YES | | NULL | |
| lasttime | int(11) | YES | | NULL | |
+--------------+---------------+------+-----+---------+----------------+
、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
+----------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+---------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| mid | int(11) | NO | | NULL | |
| thunder | text | YES | | NULL | |
+----------+---------+------+-----+---------+----------------++--------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+--------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| qkl_libdowns | 0 | PRIMARY | 1 | id | A | 39747 | NULL | NULL | | BTREE | |
+--------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
+-------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+-------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| qkl_libmore | 0 | PRIMARY | 1 | id | A | 31264 | NULL | NULL | | BTREE | |
+-------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------++--------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| mid | int(11) | NO | | NULL | |
| push | tinyint(4) | YES | | NULL | |
+--------------+--------------+------+-----+---------+----------------+数据大概都是没表3W条
执行三表联查 因为需要3个联合数据 所以就是直接三表sql:select * from qkl_librarys a,qkl_libdowns b,qkl_libmore c where a.id=b.mid and a.id=c.mid and a.push=1 order by lasttime desc limit 10;
执行大概要1分钟多才可以读取10条 求大神给分析
老大 我不太会怎么弄 能直接给我代码sql语句吗 只会基础的 百度了下 还是感觉不太懂
老大 想学习高效率mysql 不知道从何学期 我给加了你说的3个索引后马上就速度了 用explain看下几乎就没个表就查询了1条记录 一个64条记录 能说说如何个学习进阶吗