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

Ads

 
 
 

Share on Google+Share on Google+

Abinesh
How to execute my query fast..When A date filter is there in a query it takes more time for execution.?
2 Answer(s)      4 years and 3 months ago
Posted in : JDBC

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

Ads
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









Tutorials   
Java Spring Hibernate Struts Training how to retrieve text and images from mysql database and show on html page using jsp servlet How to install Neo4j on Ubuntu 15.10? please help me in these prog MYSQL - mysql copy table to another table example by creating new table solution for mapping hibernate and pojos from net beans through database Connect GWT application with Oracle inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store This code have created jTable that connected with a database.every cell of last column have a button.But this button doesn't work properly.Where is the error java program Java Database Program jdbc Database connection class in a live project ..?? What is JDBC architecture? Unable to Create DSN for excel to ms access importing data and edit that data Database Scrolling Buttons how to use foreign key in java How to delete content of a log file from linux terminal? JSP-Oracle connectivity Student Management System Java code for Saving Marathi (Indian local language ) in Mysql and retrieving the same crud operations with foreign key constraint. I really need help with this assignment question Please help me out Please Backup Failed Mysqldump Got Errno 28 On Write Upgrade MySQL 5.1 to 5.5 in cpanel mysqldump all databases com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'jpa.sequence' doesn't exist persistence xml class element persistence.xml for MySQL MySQL JDBC Driver pom dependency code Blob column jdk6 and oracle 8i connexion oracle 8i et jdk6 java [ cannot retrive date from sql ] why?? Order Entry System How to threow timeout exception when DB is not responding How to threow timeout exception when DB is not responding This is the employee form to add data to mysql database but I got error of NullPointerException, Is this write code please give me feedback as soon as possible make a method which takes user name & pwd as parameter & validate them against the database. If the corresponding user exist return true otherwise false. prabhakar validating credentials and displaying error message in login .jsp if not valid JDBC jdbc jdbc code register servlet vibhu connectiondetails from vibhu

Ads

 
Advertisement null

Ads