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

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









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.?
steps required to execute a query in JDBC
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 execute mysql query based on checkboxes values in java swing application.
How to write the new Criteria Query in my case?
HQL Query in execute method of Struts2
ModuleNotFoundError: No module named 'date-query'
plz solve my query?
jtable query compare with date
JDBC Execute Query
how to call list objects as string into my sql query?
Mysql Date Query
jtable query compare with date
jtable query compare with date
jtable query compare with date
how do i use sql like query in my jsp page
SQL date query
Date related query - Date Calendar
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'
could not execute native bulk manipulation query
JPA Named Query
How much time it takes to learn Java
SQL display date in between query
query
Query
Query
query
Query
query
query
Query
query
query
query
query
query
query
query
MY Sql Query Error - Not able to Understand the issue
query in JDBC
Mysql Date and Time
PHP SQL Query Insert
Execute database query by using sql tag of JSTL SQL library
Php Sql Query Insert
PHP SQL Query Where Clause
How to create wildcard query in Hibernate?
how to execute a file in java at regular time intrevals automattically

Ads