
11-05-2010, 03:27 AM
|
 |
|
|
Join Date: Aug 2010
Location: Pensacola, FL
Posts: 772
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
|
|
Quote:
Originally Posted by ivanp
SQL query is very slow, should be optimized:
Code:
mysql> explain SELECT albumpicture.*, album.*, user.username, user.usergroupid,
-> IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
-> FROM attachment AS albumpicture
-> LEFT JOIN album AS album ON(album.albumid = albumpicture.contentid)
-> LEFT JOIN user AS user ON(user.userid = album.userid)
-> WHERE album.state = 'public' and albumpicture.contenttypeid = 8
-> ORDER BY dateline DESC LIMIT 0, 5;
+----+-------------+--------------+--------+--------------------------------------+-----------+---------+---------------------+------+----------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+--------------+--------+--------------------------------------+-----------+---------+---------------------+------+----------------------------------------------+
| 1 | SIMPLE | album | ALL | PRIMARY | NULL | NULL | NULL | 4929 | Using where; Using temporary; Using filesort |
| 1 | SIMPLE | albumpicture | ref | contentid,contenttypeid | contentid | 4 | forum.album.albumid | 3 | Using where |
| 1 | SIMPLE | user | eq_ref | PRIMARY | PRIMARY | 4 | forum.album.userid | 1 | |
+----+-------------+--------------+--------+--------------------------------------+-----------+---------+---------------------+------+----------------------------------------------+
3 rows in set (0.00 sec)
|
I'm in Admin Control Panel. I clicked on Execute SQL Query. I copy-n-pasted that code, nothing happened but an error.
|