MySQL Select Query需要很长时间才能加载

时间:2016-03-15 11:45:53

标签: mysql

我使用下面的查询从我的mysql数据库中获取数据,获得我的预期结果但是需要很长时间,加载时间大约需要11秒:(

  

查询

select 
    campaign_id,
    location_id,
    count(campaign_id) AS total_page_view,
    count(distinct client_mac) AS unique_visitors,
    (count(campaign_id) - count(distinct client_mac)) AS returning_users,
    sum((suid = 0)) AS bounce,
    concat(cast(((sum((suid = 0)) / count(campaign_id)) * 100)
                as decimal (10 , 2 )),
            '%') AS bounce_rate,
    created_at AS created_at
from
    social_user_device_info
group by campaign_id
order by cast(created_at as date) desc
limit 15

我的 social_user_device_info 表中有(~1,027,695行)记录。

我需要快速加载,我该怎么办?

由于

0 个答案:

没有答案