????????? iBatis2 ?????????????????

 

<select id="getRawFileList" parameterClass="java.util.HashMap" resultClass="com.defonds.mysql.raw.entity.TimelineRaw">
SELECT * FROM timeline_raw_
WHERE uid=#uid#
AND did=#did#
AND channelId=#channelId#
<isNotNull  property="sectionId"> AND sectionId = #sectionId#</isNotNull>
AND
(
(startTime BETWEEN #startTime# and #endTime#)
OR
(endTime BETWEEN #startTime# and #endTime#)
OR
(
<![CDATA[
startTime<=#startTime#
]]>
AND
<![CDATA[
endTime>=#endTime#
]]>
)
)
ORDER BY startTime;
</select>

???????????????? timeline_raw ??????????????????????????(?ο???sql ????????????)?????? getRawFileList ???????????? 160 ms ?????????????????
????????????????ж??????? rawId ?????????????????rawId?????????????????????????sectionId+startTime+endTime???????(????????????????????InnoDB?????????????????????????±????????)??????sectionId??startTime?????????????????????`uid`??`did`??????
????????????????±???????????????????????????????(sectionId+startTime+endTime)???????????(`uid`??`did`)??
??????ν??????????????????????????????????????????getRawFileList ?????????????????? 11 ms???????????????????????
??????? /dev/shm ???洢???????????
?????????????У????ú??????????????????????????? tomcat ??????????????? catalina.sh ?е? CATALINA_TMPDIR ???·??????????????? /dev/shm??
?????? OSC ???????????? Java д????????? tomcat ??????????????????????????????????????????????????????????????????????????????????? df ??£????? tomcat ??????μ?????????? 8G ???????? CPU ???????????????????????????????????????? /dev/shm????????????????
???????????????? SQL ?????Ч??
?????? MySql ???????????? SQL ??? explain ??????????????Ч??????????? sql ???????????????????и????
???????????????????????????г??? 100 ????? SQL
???????????????????????????????????????????г??? 100 ????? SQL?????????????????????????????????????????г??????????? SQL?????????????? SQL ??????????????????????????ó???????????????????????????????????????????? 50ms ?? SQL ?????????ο???sql ??????????????