- 论坛徽章:
- 0
|
mysql> explain SELECT cid, major, COUNT(1) AS cnt
FROM table_cm
WHERE major = 7 AND cid != 0
GROUP BY cid, major
ORDER BY cnt DESC LIMIT 100\G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: tb_club_member
type: ref
possible_keys: idx_major_cid
key: idx_major_cid
key_len: 4
ref: const
rows: 62928
Extra: Using where; Using index; Using temporary; Using filesort
1 row in set (0.00 sec)
mysql> explain select seq, jid, cid, corp_name, corp_scale, corp_quality, corp_rank, title, name, profession, industry, kind, is_intern, department, city, head_count, salary, welfare, type, status, post_status, end_date, validity, start_date, cv_eng, update_date, create_date, email, project_tag
from table_jid
where cid in ('712','237738') AND post_status = 1 AND status = 1 AND (end_date >= DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%s')) AND (project_tag ='380' OR project_tag like '%380,%' OR project_tag like '%,380%')
order by update_date desc limit 5\G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: tb_job
type: range
possible_keys: cid
key: cid
key_len: 108
ref: NULL
rows: 1202
Extra: Using where; Using filesort
1 row in set (0.00 sec)
这两条SQL语句还能优化么? 修改索引或是SQL都可以; |
|