Jump to content

MySQL is way slow! How can I get it to speed up improving this query?


Recommended Posts

I have a query that selects data from 2 tables and counts the rows that are returned. Pretty much standard. I find it very slow, while the main table only has 12.000 rows. What can be done to speed up this query or is MySQL just at its limit here?

[code]SELECT

SQL_CALC_FOUND_ROWS

user_profile.un_id,
user_profile.username,
user_profile.country,
user_profile.state,
user_profile.city_1,
user_profile.profdate,
user_profile.profupdate,
user_profile.img,
online.status

FROM user_profile

LEFT JOIN online ON user_profile.un_id = online.un_id

WHERE user_profile.active = '1' AND user_profile.img != '0'

ORDER BY user_profile.profdate DESC

$lookup = $lookup." LIMIT $page_start, $per_page";

$query = mysql_query($lookup);

$result = mysql_query("SELECT FOUND_ROWS()");
       $total = mysql_fetch_row($result);
       $num_rows = $total[0];[/code]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.