我正在使用它来进行查询,其中我在c#.net mysql连接中达到20。 这个查询需要永远执行,当我在MySQL shell中运行它需要3分钟。 所有其他查询运行正常。
string sqlQuery = "(SELECT TimeStamp, AVG(FwdHr), W FROM Meter_Data " +
"WHERE TimeStamp Between " +
(timeSt[0] - window).ToString() +
" AND " + (timeSt[0] + window).ToString() +
" AND DeviceID = '"+deviceId+"')";
for (int i = 1; i < timeSt.Count; i++)
{
sqlQuery = sqlQuery+ " UNION (SELECT TimeStamp, AVG(FwdHr), W
FROM Meter_Data WHERE TimeStamp Between " +
(timeSt[i] - window).ToString() + " AND " +
(timeSt[i] + window).ToString() +
" AND DeviceID = '" + deviceId + "')";
}
答案 0 :(得分:0)
要检查的事项: