# Query_time: 11.041339 Lock_time: 0.000074 Rows_sent: 1 Rows_examined: 4033514
use mytable;
SET timestamp=1441090564;
select c.fetching_method,cc.book_chapter_id,cc.book_episode_name,cc.book_episode_number,cc.book_id,
ccc.book_image_path,ccc.book_page_sequence,cccc.book_name,cccc.book_permalink
from book_source c, book_chapter cc,book_page ccc,book cccc
where c.book_source_id = cc.book_source_id AND cc.book_chapter_id = ccc.book_chapter_id AND cccc.book_id = cc.book_id AND
cccc.book_permalink='Dancing_Cow' AND cc.book_episode_number > '42' ORDER BY book_episode_number ASC LIMIT 1;
mysql> desc book;
+--------------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------------+------------------+------+-----+---------+----------------+
| book_id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| description | text | YES | | NULL | |
| book_picture | text | YES | | NULL | |
| book_permalink | text | YES | | NULL | |
| total_view_count | int(16) | NO | | 0 | |
| thumbnail | int(2) | YES | | NULL | |
| book_rating | double | YES | | NULL | |
| fail_retry | int(2) | NO | | 0 | |
+--------------------+------------------+------+-----+---------+----------------+
18 rows in set (0.01 sec)
mysql> desc book_page;
+---------------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------------+------------------+------+-----+---------+----------------+
| book_page_id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| book_chapter_id | int(10) | YES | | NULL | |
| book_image_path | text | YES | | NULL | |
| book_page_sequence | double | YES | | NULL | |
| date_time_added | text | YES | | NULL | |
| date_time_modified | text | YES | | NULL | |
| watermark | int(2) | YES | | NULL | |
| book_related | text | YES | | NULL | |
+---------------------+------------------+------+-----+---------+----------------+
8 rows in set (0.00 sec)
mysql> desc book_source;
+--------------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------------+------------------+------+-----+---------+----------------+
| book_source_id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| book_id | int(10) | YES | | NULL | |
| book_source_url | varchar(150) | YES | UNI | NULL | |
| fetching_method | text | YES | | NULL | |
| source_book_name | text | YES | | NULL | |
| process_id | int(10) | YES | | NULL | |
| disable | int(1) | YES | | NULL | |
| source_group | int(2) | YES | | NULL | |
| fail_retry | int(2) | YES | | 0 | |
+--------------------+------------------+------+-----+---------+----------------+
11 rows in set (0.00 sec)
mysql> desc book_chapter;
+----------------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+------------------+------+-----+---------+----------------+
| book_chapter_id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| book_view_count | int(10) | YES | | NULL | |
| book_episode_number | double | YES | | NULL | |
| book_episode_name | text | YES | | NULL | |
| book_source_id | int(10) | YES | | NULL | |
| book_id | int(20) | YES | | NULL | |
| book_complete | text | YES | | NULL | |
| total_pages | double | YES | | NULL | |
| chapter_view_count | int(16) | NO | | 0 | |
| book_fix | int(2) | YES | | NULL | |
| original_url | text | YES | | NULL | |
+----------------------+------------------+------+-----+---------+----------------+
13 rows in set (0.00 sec)
我有一个非常坏的连接语句引起我的服务器上沉重的负担。 有没有一种方法可以改进此联合声明以使用较少的行。Mysql的使用超过400多万行获得1个查询
我的这张表book_page有大约1米的记录。我怎么能优化到真正能够绘制数据而不使用那么多记录(4米),因为我想要的数据实际上很少。只有很少的值