stockton Posted November 16, 2007 Share Posted November 16, 2007 I have the following Oracle SQL statement which takes quite a while to execute. SELECT * FROM ( SELECT TRANS_CODE, Sum(TRANS_CASH_IN) AS SumOfTRANS_CASH_IN FROM TRANSACT WHERE TO_CHAR(TRANS_DATE,'MM')= TO_CHAR(sysdate,'MM') AND ((TRANS_COMMENT) LIKE 'Dacom%') AND ((TRANS_MACHINE_NO) NOT LIKE '7%') GROUP BY TRANS_CODE ORDER BY Sum(TRANS_CASH_IN) DESC; ) WHERE rownum <= 250; Please make suggestions on how it could be made quicker. Link to comment https://forums.phpfreaks.com/topic/77599-solved-speed-up-select-statement/ Share on other sites More sharing options...
gizmola Posted November 20, 2007 Share Posted November 20, 2007 Did you do an explain plan and look at that first? Link to comment https://forums.phpfreaks.com/topic/77599-solved-speed-up-select-statement/#findComment-395015 Share on other sites More sharing options...
Y.O. Posted January 4, 2008 Share Posted January 4, 2008 A simple way to speed it up is using hint: add hint comment /*+ALL_ROWS*/ after each SELECT Link to comment https://forums.phpfreaks.com/topic/77599-solved-speed-up-select-statement/#findComment-430748 Share on other sites More sharing options...
phporaclehosting Posted January 7, 2008 Share Posted January 7, 2008 i agree about the explain plan, and look at where you could stick an index, or two. remember you can have binary or even three way indexes, but these add complexity and size. Link to comment https://forums.phpfreaks.com/topic/77599-solved-speed-up-select-statement/#findComment-432684 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.