我有 15 个查询为页面上的表格动态生成数据以用于报告。每个查询需要 250 到 900 毫秒,这意味着页面加载时间为 4 到 13 秒,具体取决于服务器负载。加载时间导致一些用户认为页面根本不会加载。
我想知道是否有某种方法可以简化查询以提供更可接受的加载时间。这是查询之一:
<cfquery datasource="MeetingDB" name="One">
SELECT COUNT( meetingID ) AS countatron
FROM case_meeting
WHERE meetingID
IN (
SELECT DISTINCT a.meetingID
FROM case_meeting a
INNER JOIN meeting b ON a.meetingID = b.meetingID
WHERE b.categoryID = '1'
AND SUBSTRING( meetingCode, 5, 2 )
BETWEEN 12
AND 22
AND SUBSTRING( meetingCode, 7, 2 )
BETWEEN 01
AND 12
AND SUBSTRING( meetingCode, 9, 2 )
BETWEEN 01
AND 31
)
AND caseID
IN (
'1', '2', '3', '28', '29', '30', '39', '40', '45'
)
GROUP BY meetingID
HAVING COUNT( caseID ) > 0 AND COUNT( caseID ) < 2
</cfquery>
<td><cfoutput> #One.recordcount# </cfoutput></td>