How to execute my query fast..When A date filter is there in a query it takes more time for execution.?

Ads
 

How to execute my query fast..When A date filter is there in a query it takes more time for execution.?

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...

View Answers

February 10, 2013 at 8:27 AM

Hi,

Add index on the date field.

You can use the following sql:

ALTER TABLE mytable ADD INDEX (mydatefield);

Thanks


February 11, 2013 at 3:13 PM

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....

Ads









Related Tutorials/Questions & Answers:
How to execute my query fast..When A date filter is there in a query it takes more time for execution.?
How to execute mysql query based on checkboxes values in java swing application.
Advertisements
How to execute mysql query based on checkboxes values in java swing application.
How to execute mysql query based on checkboxes values in java swing application.
How to write the new Criteria Query in my case?
ModuleNotFoundError: No module named 'date-query'
HQL Query in execute method of Struts2
jtable query compare with date
Mysql Date Query
how to call list objects as string into my sql query?
JDBC Execute Query
plz solve my query?
jtable query compare with date
jtable query compare with date
jtable query compare with date
SQL date query
could not execute native bulk manipulation query
ModuleNotFoundError: No module named 'django-rest-query-params-filter'
ModuleNotFoundError: No module named 'django-rest-query-params-filter'
ModuleNotFoundError: No module named 'django-rest-query-params-filter'
How much time it takes to learn Java
SQL display date in between query
Query
query
query
query
query
query
query
Query
query

Ads