存储过程 建立临时表 通过循环

DROP PROCEDURE IF EXISTS `weather_report_cities`$$

CREATE DEFINER=`epimap`@`%` PROCEDURE `weather_report_cities`(
IN p_citiesorurls VARCHAR(21845) ,
IN p_city_count INT,
OUT p_count INT
)
BEGIN
   DECLARE v_i INT  DEFAULT 1;
   DECLARE v_length INT;
   DECLARE v_city VARCHAR(20);
  -- set @v_city = v_city;
  SET v_length = p_city_count;
   TRUNCATE epimap.ep_weather_report_temp;
   TRUNCATE epimap.`ep_weather_sk_temperature_temp`;
  -- truncate epimap.test_city;
-- SET SQL_SAFE_UPDATES=0; -- so slow on large talbe data using Innodb ,cause write data to log
-- delete from epimap.ep_weather_report_temp;
-- SET SQL_SAFE_UPDATES=1;
WHILE v_i<=v_length DO
   
   SELECT func_splitString(p_citiesorurls, ',', v_i) INTO v_city;   
    SET v_city = TRIM(v_city);
  --  insert into test_city values(v_city);
    INSERT INTO epimap.ep_weather_report_temp
(city,city_en,date_y,WEEK,cityid,temp1,temp2,temp3,temp4,temp5,temp6,weather1,weather2,weather3,weather4,weather5,weather6,wind1,wind2,wind3,wind4,wind5,wind6,fl1,fl2,fl3,fl4,fl5,fl6,ind,index_xs,index_uv,index_xc,index_tr,index_co,index_cl,index_ls,index_ag,create_time
)
( SELECT * FROM
((SELECT city,city_en,date_y,WEEK,cityid,temp1,temp2,temp3,temp4,temp5,temp6,weather1,weather2,weather3,weather4,weather5,weather6,wind1,wind2,wind3,wind4,wind5,wind6,fl1,fl2,fl3,fl4,fl5,fl6,ind,index_xs,index_uv,index_xc,index_tr,index_co,index_cl,index_ls,index_ag,create_time FROM epimap.ep_weather_report
WHERE city = v_city    ORDER BY create_time DESC LIMIT 1)
UNION
(SELECT city,city_en,date_y,WEEK,cityid,temp1,temp2,temp3,temp4,temp5,temp6,weather1,weather2,weather3,weather4,weather5,weather6,wind1,wind2,wind3,wind4,wind5,wind6,fl1,fl2,fl3,fl4,fl5,fl6,ind,index_xs,index_uv,index_xc,index_tr,index_co,index_cl,index_ls,index_ag,create_time FROM epimap.ep_weather_report
 WHERE cityid = v_city    ORDER BY create_time DESC LIMIT 1)
) AS new_ep_weather_report_temp
) ;

 INSERT INTO epimap.`ep_weather_sk_temperature_temp`
(city,wse,wd,ws,TIME)
    (SELECT * FROM    
    ((SELECT city,wse,wd,ws,TIME FROM epimap.`ep_weather_sk_temperature` WHERE city = v_city ORDER BY create_time DESC LIMIT 1)
    UNION
    (SELECT city,wse,wd,ws,TIME FROM epimap.`ep_weather_sk_temperature` WHERE cityid = v_city ORDER BY create_time DESC LIMIT 1)
    )AS new_weather_sk_temp);

  SET v_i=v_i+1;
END WHILE;
  SELECT COUNT(*) INTO p_count FROM  epimap.ep_weather_report_temp;
  SELECT a.city,cityid AS CODE,temp1 AS temp,weather1 AS weather0,
  CONCAT(wse,'℃') AS felltemp,wd AS wind,ws AS windspeed,CONCAT('今天',CONCAT(TIME,'发布')) AS realtime
 FROM epimap.ep_weather_report_temp AS a LEFT JOIN epimap.`ep_weather_sk_temperature_temp` AS b
ON a.city = b.city
;

END$$


即得到两张表结合后的结果,注意看

Coarse-Grained Reconfigurable Architectures (CGRAs) are an at- tractive platform that promise simultaneous high-performance and high power-efficiency. One of the primary challenges in using CGRAs is to develop efficient compilers that can automatically and efficiently map applications to the CGRA. To this end, this paper makes several contributions: i) Using Re-computation for Resource Limitations: For the first time in CGRA compilers, we propose the use of re-computation as a solution for resource limita- tion problem. This extends the solutions space, and enables better mappings, ii) General Problem Formulation: A precise and gen- eral formulation of the application mapping problem on a CGRA is presented, and its computational complexity is established. iii) Ex- tracting an Efficient Heuristic: Using the insights from the problem formulation, we design an effective global heuristic called EPIMap. EPIMap transforms the input specification (a directed graph) to an Epimorphic equivalent graph that satisfies the necessary conditions for mapping on to a CGRA, reducing the search space. Experi- mental results on 14 important kernels extracted from well known benchmark programs show that using EPIMap can improve the per- formance of the kernels on CGRA by more than 2.8X on average, as compared to one of the best existing mapping algorithm, EMS. EPIMap was able to achieve the theoretical best performance for 9 out of 14 benchmarks, while EMS could not achieve the theoreti- cal best performance for any of the benchmarks. EPIMap achieves better mappings at acceptable increase in the compilation time.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值