我在将数据从MySQL加载到Matlab时遇到问题。
我正在运行存储过程。当我从MySQL运行它时,返回1,500行。
当我从Matlab运行它时,它会在我第一次启动Matlab时返回1条记录。如果我重新运行它几次,我最终可能会获得1,500行。早些时候需要30分钟才会返回1,500行。
我的商店程序是:
-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `latest_hl_tradables`()
BEGIN
DECLARE latest_date DATE ;
SELECT max(available_on_platform.on_date)
FROM available_on_platform
INNER JOIN platform ON (available_on_platform.platform_id=platform.id)
where platform.name='aaa'
INTO latest_date;
SELECT fund_id,fund_class_id,fund_class.name as fund_class_name,sedol,isin,max(on_date) as on_date
FROM available_on_platform
INNER JOIN fund_class ON (fund_class.id=available_on_platform.fund_class_id)
INNER JOIN platform ON (available_on_platform.platform_id=platform.id)
WHERE on_date>=latest_date-5
AND platform.name='aaa'
GROUP BY fund_class_id,fund_class.name,sedol,isin;
END
我的Matlab代码是:
conn=database('fund_data3','','');
sql = 'call latest_hl_tradables()';
curs = exec(conn,sql);
curs = fetch(curs);