Boopaathy
Boopaathy

Reputation: 328

MySQL select query performance issue

I'm using a table to do login, the table has a record of 2500. when i try to login it takes nearly 30-40 seconds to load. I'm using PHP and MySQL.I need to make the sql query faster to check the data. Solutions are welcomed thanks in advance pls help me out

Upvotes: 2

Views: 268

Answers (2)

codingbiz
codingbiz

Reputation: 26376

You should have included your query so we can examine it. Don't pull all your records (e.g. don't use Select * from users) and then loop through to find a match. Instead, use WHERE clause to limit your records to (i.e. one row). That is

SELECT col1,col2,.. FROM Users WHERE username='username' AND password='password'

You can try that and see the performance...

Upvotes: 0

Amir Ali
Amir Ali

Reputation: 26

When locating the causes of problems of performance issues, there are many things to consider in the your application stack:

  1. Database: Indexes, Joins, Query Formation
  2. Network in between: Routing issues, Bandwith, connectivity speed
  3. Code: Check if your code structure is not creating unecessary delays, forexample some people have their validations span over client and server both in a single method which increases method lifetime longer. Try to put validation's core logic on database side like in stored procedures. Try to use methods with lesser overheads.

Upvotes: 1

Related Questions