Jump to content

too many queries...


acidglitter

Recommended Posts

my site has been down or incredibly slow most of this week. i've been talking to my server and now its starting to look like the problem is there are too many mysql queries and they're crashing the site... i have no idea where to start to fix this. does anyone have any ideas?

Link to comment
Share on other sites

I don't know what "other things" you are talking about ....

 

this is just what my server said:

"Enabling this log would be a global change at the root of the server and you won't have access to the log file."

 

 

the one on the home page is like this

SELECT *,
	DATEDIFF(DATE(vip), CURDATE()) AS 'days_left'
FROM members
WHERE DATEDIFF(DATE(vip), CURDATE())>0
	AND friendid NOT IN ($featuredspaces)
ORDER BY DATEDIFF(DATE(vip), CURDATE()) DESC

 

and with explain it said..

 

id select_type table type possible_keys key key_len ref rows Extra

1 SIMPLE members ALL NULL NULL NULL NULL 79011 Using where; Using temporary; Using filesort

 

 

 

and on the add page

SELECT friendid, name, picture, points,
DATEDIFF(DATE(vip), CURDATE()) as 'vip' FROM members
WHERE friendid NOT IN
(SELECT theirs FROM added WHERE yours='{$_SESSION['friendid']}')
AND friendid != '{$_SESSION['friendid']}'
ORDER BY (DATEDIFF(DATE(vip), CURDATE())>0) DESC, points DESC, lastlogin DESC LIMIT $limit

 

and the explain for that

 

id select_type table type possible_keys key key_len ref rows Extra

1 PRIMARY members ALL NULL NULL NULL NULL 79013 Using where; Using temporary; Using filesort

2 DEPENDENT SUBQUERY added ALL NULL NULL NULL NULL 3216 Using where

 

Link to comment
Share on other sites

Wow, nice queries, have you got any indexes on your tables? Because it seems that none are being used. Also a "blah IN (...)" is not particularly efficient when the (...) is a SELECT *, thus I recommend you change this to a LEFT JOIN and add indexes on the adjoining columns.

Link to comment
Share on other sites

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.