We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,610 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

How to increase the speed of a mysql select query?

i have a lot of mysql data (2 Lakhs data) how to collect data with in a seconds ? any idea

thanks in advance

5
Contributors
5
Replies
13 Hours
Discussion Span
11 Months Ago
Last Updated
6
Views
Question
Answered
sri.
Newbie Poster
18 posts since Jun 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

If you run explain table_name in your mysql client and paste the output together with an example of data maybe we can give you a hand. And also paste the query.

cereal
Veteran Poster
1,195 posts since Aug 2007
Reputation Points: 358
Solved Threads: 231
Skill Endorsements: 22

put indexes on the columns that you use in the where clause

steelshark
Junior Poster in Training
59 posts since Sep 2010
Reputation Points: 10
Solved Threads: 6
Skill Endorsements: 0

In addition to the suggestions:

Using LIMIT clause may speed things up if you're after a specific number of records. Avoiding the '*' for return fields and naming the exact fields you want to return should also speed things up.
Using JOINS instead of subqueries where possible.

diafol
Keep Smiling
Moderator
10,838 posts since Oct 2006
Reputation Points: 1,675
Solved Threads: 1,534
Skill Endorsements: 61

SELECT * FROM table_name WHERE start_date="$st_date" AND end_date="$en_date";

I hope you are having start_date and end_date fields in your Table....:)

phpHelp
Newbie Poster
23 posts since Jul 2012
Reputation Points: 0
Solved Threads: 1
Skill Endorsements: 0

2 Lakhs

Are we talking 200,000 (or 2,00,000 in Asian num)? So you're saying that you have a long-ish table? Please post your query. We can't help properly if you don't provide this info.

diafol
Keep Smiling
Moderator
10,838 posts since Oct 2006
Reputation Points: 1,675
Solved Threads: 1,534
Skill Endorsements: 61
Question Answered as of 11 Months Ago by diafol, cereal, steelshark and 1 other

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.0682 seconds using 2.69MB