其中,node_mac、up_date已经建立索引

解决方案 »

  1.   

    即使只查询一个内容,也需要2秒:select max(data.id) id, data.node_mac, node.name node_name, max(data.up_date) up_date, 
               group_concat(data.temperature order by up_date desc separator ',') as temperature
                from t_data data
                 left join t_node node on data.node_mac = node.mac
                inner join t_modulename modulename on modulename.module_name = node.name 
                 group by node_mac
      

  2.   

    贴出 explain select ... 显示一下执行计划以分析效率。
      

  3.   


    Creating Sort Index 3.9 s 65.60% 1 3.9 s
    sending data                1.9 s       34.00%