数据总量大概100万,下面的执行后需要25秒左右,请帮忙优化
select straight_join count(c.company_id) as count_com
from xx_hm_companies c
inner join xx_users_hrmanagers h
on c.company_id=h.company_id
inner join xx_pd_accounts pa
on pa.`enterprise_id`=h.`enterprise_id`
where
not exists
( select 1 from xx_hm_applications a where a.`company_id`=c.company_id and FROM_UNIXTIME(a.apply_date)>='2009-07-30' and FROM_UNIXTIME(a.apply_date)<='2009-07-30')
select straight_join count(c.company_id) as count_com
from xx_hm_companies c
inner join xx_users_hrmanagers h
on c.company_id=h.company_id
inner join xx_pd_accounts pa
on pa.`enterprise_id`=h.`enterprise_id`
where
not exists
( select 1 from xx_hm_applications a where a.`company_id`=c.company_id and FROM_UNIXTIME(a.apply_date)>='2009-07-30' and FROM_UNIXTIME(a.apply_date)<='2009-07-30')
解决方案 »
- 我快疯了,我的mysql query browser乱码解决不了,他们说有my.ini,我怎么找不到啊?
- 如何将mysql中的数据从一台机器转移到另一台?
- postgreSQL免安装版本速度问题。
- 能否用一条sql更新多条记录(mysql)?
- charset设置~!
- 高分请教,mysql中的表格怎样转换成EXCEL文件格式呢?在线等待!
- 创建存储过程失败,到底是什么原因呢。
- MySQL 中 Top 怎么用啊?
- 求一个sql,级联查询,最好是一个sql兼容oracle和mysql
- mysql 里面where条件直接使用变量的问题
- 写了一个MySQL连接测试,不行,帮看看
- 靠!Mysql delete不支持where???????
from xx_hm_companies c
inner join xx_users_hrmanagers h
on c.company_id=h.company_id
inner join xx_pd_accounts pa
on pa.`enterprise_id`=h.`enterprise_id`
left join (select company_id from xx_hm_applications where FROM_UNIXTIME(a.apply_date)='2009-07-30') a
on a.`company_id`=c.company_id
where c.company_id is null