When A date filter is there in a query it runs for 10 mins with 4000 records.. when the date filter is commented it runs in 30 seconds with 5000 records... what is the problem ... how to execute my query fast... please help...
Add index on the date field.
You can use the following sql:
ALTER TABLE mytable ADD INDEX (mydatefield);
i have already created index... but the problem is....
query is-- select * from 1stTable as ai join 2ndTable as reg on ai.coloumn=reg.coloumn and ai.mode=3 and ai.year=2013 and ai.groupidcoloumnIN ( 1, 12, 13, 17 ) AND reg.mode=3 AND ai.applnissueddate BETWEEN '2013-01-18' AND '2013-01-22'
This Query is getting late when i put 19 and other following dates . but before 18 the query runs in 6 secs when i put 19and follow it runs for 10 mins....
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.