Mysql 负载高 - CPU 360%
我的 mysql cpu 使用率很高,服务器 Intel(R) Xeon(R) CPU E5520 @ 2.27GHz 16 核处理器和 16 GB 内存在 centos 5.4 上运行,
服务器的平均负载为 500 - 900,这里
的 数字确实很高是一些帮助我们解决
mysql配置文件/etc/my.cnf的
[mysqld]
local-infile=0
safe-show-database
skip-locking
skip-innodb
skip-networking
old_passwords
back_log = 50
skip-innodb
max_connections = 40000
key_buffer_size = 640M
myisam_sort_buffer_size = 256M
myisam_max_sort_file_size = 2048M
join_buffer_size = 3M
read_buffer_size = 3M
sort_buffer_size = 3M
table_cache = 8000
thread_cache_size = 1024
wait_timeout = 300
interactive_timeout = 600
connect_timeout = 10
tmp_table_size = 1024M
max_heap_table_size = 1024M
max_allowed_packet = 128M
net_buffer_length = 16384
max_connect_errors = 100000
long_query_time=0
thread_concurrency = 32
concurrent_insert = 2
table_lock_wait_timeout = 30
read_rnd_buffer_size = 4M
bulk_insert_buffer_size = 16M
query_cache_limit = 4M
query_cache_size = 128M
query_cache_type = 1
query_prealloc_size = 262144
query_alloc_block_size = 65536
range_alloc_block_size = 4096
transaction_alloc_block_size = 8192
transaction_prealloc_size = 4096
default-storage-engine = MyISAM
max_write_lock_count = 8
tmpdir=/mysqltmp
set-variable=long_query_time=1
log-slow-queries=/var/log/mysql/log-slow-queries.log
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
nice = -10
open_files_limit = 8192
[mysqldump]
quick
max_allowed_packet = 128M
[myisamchk]
key_buffer_size = 640M
sort_buffer_size = 64M
read_buffer_size = 16M
write_buffer_size = 16M
[mysqlhotcopy]
interactive-timeout
信息===============注意我删除了一些查询因为我不能在这里发布超过30000个字符== =====================================
SHOW FULL PROCESSLIST;
393786 site_dtl localhost site_dtl Query 1 Locked UPDATE dle_post SET news_read = news_read +1 WHERE id = '3657'
402437 root localhost None Sleep 496 --- ---
409374 root localhost None Sleep 180 --- ---
411150 tgofmovi_home localhost tgofmovi_home Sleep 40 --- ---
411230 tgofmovi_home localhost tgofmovi_home Sleep 36 --- ---
411401 site_dtl localhost site_dtl Query 1 Locked SELECT *
FROM dle_post
WHERE approve = '1'
AND category
IN ( 80 )
ORDER BY date DESC
LIMIT 0 , 10
411410 site_dtl localhost site_dtl Query 0 Locked SELECT *
FROM dle_post
WHERE approve = '1'
AND category
IN ( 80 )
ORDER BY date DESC
LIMIT 0 , 10
411430 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(1,2,7,6,8) AND id NOT IN (0) AND date >= '
411433 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411439 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411443 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411444 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(91) AND id NOT IN (0) AND date >= '2010-11
411490 site_dtl localhost site_dtl Query 2 Sorting result SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411491 site_dtl localhost site_dtl Query 2 Sorting result SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411498 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411509 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(91) AND id NOT IN (0) AND date >= '2010-11
411511 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411512 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411513 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411514 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411515 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411526 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411527 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE
411541 site_dtl localhost site_dtl Query 2 Sorting result SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411543 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(1,2,7,6,8) AND id NOT IN (0) AND date >= '
411544 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(1,2,7,6,8) AND id NOT IN (0) AND date >= '
411545 site_dtl localhost site_dtl Query 2 Sorting result SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411547 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(1,2,7,6,8) AND id NOT IN (0) AND date >= '
411548 site_dtl localhost site_dtl Query 2 Sorting result SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411549 site_dtl localhost site_dtl Query 2 Sorting result SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411565 site_dtl localhost site_dtl Query 2 Sorting result SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
approve='1' AND category IN(91) AND id NOT IN (0) AND date >= '2010-11
411618 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(91) AND id NOT IN (0) AND date >= '2010-11
411619 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411620 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(91) AND id NOT IN (0) AND date >= '2010-11
411621 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(91) AND id NOT IN (0) AND date >= '2010-11
411622 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(91) AND id NOT IN (0) AND date >= '2010-11
411623 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(91) AND id NOT IN (0) AND date >= '2010-11
411624 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(91) AND id NOT IN (0) AND date >= '2010-11
411625 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(91) AND id NOT IN (0) AND date >= '2010-11
411796 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411797 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37,43,54,55,56,60,61,62,63,64,69,70,71,46,5
411798 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37,43,54,55,56,60,61,62,63,64,69,70,71,46,5
411800 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411801 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411802 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411803 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411804 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411807 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411808 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411809 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411811 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411812 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411813 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411814 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411818 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411819 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411820 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411821 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411822 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411823 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411825 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411826 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411827 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411828 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411829 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411830 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411831 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411833 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411834 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(48) AND id NOT IN (0) AND date >= '2010-11
411836 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411837 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411838 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411841 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411842 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411843 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411845 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411855 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411856 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' AND date >= '2010-
411857 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411858 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411859 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411860 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411861 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411862 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411863 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411864 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411865 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411866 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411867 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411868 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411869 site_dtl localhost site_dtl Query 2 Sorting result SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411870 site_dtl localhost site_dtl Query 1 Sending data SELECT COUNT(*) as count FROM dle_post WHERE category regexp '[[:<:]](81)[[:>:]]' AND approve AND da
411871 site_dtl localhost site_dtl Query 2 Sorting result SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411872 site_dtl localhost site_dtl Query 2 Sorting result SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411873 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411874 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411875 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411876 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411877 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411878 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411879 site_dtl localhost site_dtl Query 1 Sending data SELECT COUNT(*) as count FROM dle_post WHERE category regexp '[[:<:]](44|80|81|54|55|60|61|62|63|64|
411890 site_dtl localhost site_dtl Query 1 Sending data SELECT COUNT(*) as count FROM dle_post WHERE category regexp '[[:<:]](44|80|81|54|55|60|61|62|63|64|
411891 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' AND date >= '2010-
411892 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411893 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411894 site_dtl localhost site_dtl Query 1 Sending data SELECT COUNT(*) as count FROM dle_post WHERE category regexp '[[:<:]](44|80|81|54|55|60|61|62|63|64|
411895 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411896 site_dtl localhost site_dtl Query 1 Sending data SELECT COUNT(*) as count FROM dle_post WHERE category regexp '[[:<:]](36|37|43|44|80|81|54|55|60|61|
411897 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411898 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411899 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411900 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411901 site_dtl localhost site_dtl Query 2 Sorting result SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411902 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411903 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411904 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411905 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411907 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411908 site_dtl localhost site_dtl Query 2 Sorting result SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, xfields, title, cat
411909 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411910 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411911 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411912 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411919 site_dtl localhost site_dtl Query 2 Sorting result SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411921 site_dtl localhost site_dtl Query 2 Sorting result SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411922 site_dtl localhost site_dtl Query 2 Sorting result SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411950 root localhost mysql Query 0 --- SHOW PROCESSLIST
=========== ===========================================
SHOW CREATE TABLE dle_post\G
*************************** 1. row ***************************
Table: dle_post
Create Table: CREATE TABLE `dle_post` (
`id` int(11) NOT NULL auto_increment,
`autor` varchar(40) NOT NULL default '',
`date` datetime NOT NULL default '0000-00-00 00:00:00',
`short_story` text NOT NULL,
`full_story` text NOT NULL,
`xfields` text NOT NULL,
`title` varchar(255) NOT NULL default '',
`descr` varchar(200) NOT NULL default '',
`keywords` text NOT NULL,
`category` varchar(200) NOT NULL default '0',
`alt_name` varchar(200) NOT NULL default '',
`comm_num` smallint(5) unsigned NOT NULL default '0',
`allow_comm` tinyint(1) NOT NULL default '1',
`allow_main` tinyint(1) unsigned NOT NULL default '1',
`allow_rate` tinyint(1) unsigned NOT NULL default '1',
`approve` tinyint(1) NOT NULL default '0',
`fixed` tinyint(1) NOT NULL default '0',
`rating` smallint(5) NOT NULL default '0',
`allow_br` tinyint(1) NOT NULL default '1',
`vote_num` smallint(5) unsigned NOT NULL default '0',
`news_read` mediumint(8) NOT NULL default '0',
`votes` tinyint(1) NOT NULL default '0',
`access` varchar(150) NOT NULL default '',
`symbol` char(3) NOT NULL default '',
`flag` tinyint(1) NOT NULL default '0',
`editdate` varchar(15) NOT NULL default '',
`editor` varchar(40) NOT NULL default '',
`reason` varchar(255) NOT NULL default '',
`view_edit` tinyint(1) NOT NULL default '0',
`tags` varchar(255) NOT NULL default '',
`metatitle` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`),
KEY `autor` (`autor`),
KEY `alt_name` (`alt_name`),
KEY `category` (`category`),
KEY `approve` (`approve`),
KEY `allow_main` (`allow_main`),
KEY `date` (`date`),
KEY `symbol` (`symbol`),
KEY `comm_num` (`comm_num`),
KEY `tags` (`tags`),
FULLTEXT KEY `short_story` (`short_story`,`full_story`,`xfields`,`title`)
) ENGINE=MyISAM AUTO_INCREMENT=5265 DEFAULT CHARSET=utf8
1 row in set (0.03 sec)
========= =============================================
SHOW TABLE STATUS LIKE 'dle_post'\G
*************************** 1. row ***************************
Name: dle_post
Engine: MyISAM
Version: 10
Row_format: Dynamic
Rows: 4971
Avg_row_length: 6685
Data_length: 33232848
Max_data_length: 281474976710655
Index_length: 7998464
Data_free: 0
Auto_increment: 5266
Create_time: 2010-04-01 15:21:19
Update_time: 2010-11-14 19:24:19
Check_time: 2010-06-20 01:32:40
Collation: utf8_general_ci
Checksum: NULL
Create_options:
Comment:
1 row in set (0.00 sec)
======= ===============================================
SHOW TABLE STATUS LIKE 'dle_post'\G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: NULL
type: NULL
possible_keys: NULL
key: NULL
key_len: NULL
ref: NULL
rows: NULL
Extra: No tables used
1 row in set (0.00 sec)
===== =================================================
SHOW VARIABLES LIKE '%buffer%';
+-------------------------------+-----------+
| Variable_name | Value |
+-------------------------------+-----------+
| bulk_insert_buffer_size | 16777216 |
| innodb_buffer_pool_awe_mem_mb | 0 |
| innodb_buffer_pool_size | 8388608 |
| innodb_log_buffer_size | 1048576 |
| join_buffer_size | 3145728 |
| key_buffer_size | 671088640 |
| myisam_sort_buffer_size | 268435456 |
| net_buffer_length | 16384 |
| preload_buffer_size | 32768 |
| read_buffer_size | 3145728 |
| read_rnd_buffer_size | 4194304 |
| sort_buffer_size | 3145728 |
+-------------------------------+-----------+
12 rows in set (0.00 sec)
=== =====================================================
我希望这些信息是解决此问题所必需的
注意:此命令已在服务器负载 180 - 350 时执行,
谢谢
i having a high mysql cpu usage , on server Intel(R) Xeon(R) CPU E5520 @ 2.27GHz 16 core of processors and 16 G.B ram running on centos 5.4
the load average for the server 500 - 900 , that's really HIGH NUMBERS
here is some information to help us out
mysql configuration file /etc/my.cnf
[mysqld]
local-infile=0
safe-show-database
skip-locking
skip-innodb
skip-networking
old_passwords
back_log = 50
skip-innodb
max_connections = 40000
key_buffer_size = 640M
myisam_sort_buffer_size = 256M
myisam_max_sort_file_size = 2048M
join_buffer_size = 3M
read_buffer_size = 3M
sort_buffer_size = 3M
table_cache = 8000
thread_cache_size = 1024
wait_timeout = 300
interactive_timeout = 600
connect_timeout = 10
tmp_table_size = 1024M
max_heap_table_size = 1024M
max_allowed_packet = 128M
net_buffer_length = 16384
max_connect_errors = 100000
long_query_time=0
thread_concurrency = 32
concurrent_insert = 2
table_lock_wait_timeout = 30
read_rnd_buffer_size = 4M
bulk_insert_buffer_size = 16M
query_cache_limit = 4M
query_cache_size = 128M
query_cache_type = 1
query_prealloc_size = 262144
query_alloc_block_size = 65536
range_alloc_block_size = 4096
transaction_alloc_block_size = 8192
transaction_prealloc_size = 4096
default-storage-engine = MyISAM
max_write_lock_count = 8
tmpdir=/mysqltmp
set-variable=long_query_time=1
log-slow-queries=/var/log/mysql/log-slow-queries.log
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
nice = -10
open_files_limit = 8192
[mysqldump]
quick
max_allowed_packet = 128M
[myisamchk]
key_buffer_size = 640M
sort_buffer_size = 64M
read_buffer_size = 16M
write_buffer_size = 16M
[mysqlhotcopy]
interactive-timeout
===============NOTE I DELETE SOME QUERIES BECAUSE I CANNOT POST HERE MORE THAN 30000 CHARACTER=====================================
SHOW FULL PROCESSLIST;
393786 site_dtl localhost site_dtl Query 1 Locked UPDATE dle_post SET news_read = news_read +1 WHERE id = '3657'
402437 root localhost None Sleep 496 --- ---
409374 root localhost None Sleep 180 --- ---
411150 tgofmovi_home localhost tgofmovi_home Sleep 40 --- ---
411230 tgofmovi_home localhost tgofmovi_home Sleep 36 --- ---
411401 site_dtl localhost site_dtl Query 1 Locked SELECT *
FROM dle_post
WHERE approve = '1'
AND category
IN ( 80 )
ORDER BY date DESC
LIMIT 0 , 10
411410 site_dtl localhost site_dtl Query 0 Locked SELECT *
FROM dle_post
WHERE approve = '1'
AND category
IN ( 80 )
ORDER BY date DESC
LIMIT 0 , 10
411430 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(1,2,7,6,8) AND id NOT IN (0) AND date >= '
411433 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411439 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411443 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411444 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(91) AND id NOT IN (0) AND date >= '2010-11
411490 site_dtl localhost site_dtl Query 2 Sorting result SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411491 site_dtl localhost site_dtl Query 2 Sorting result SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411498 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411509 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(91) AND id NOT IN (0) AND date >= '2010-11
411511 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411512 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411513 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411514 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411515 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411526 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411527 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE
411541 site_dtl localhost site_dtl Query 2 Sorting result SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411543 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(1,2,7,6,8) AND id NOT IN (0) AND date >= '
411544 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(1,2,7,6,8) AND id NOT IN (0) AND date >= '
411545 site_dtl localhost site_dtl Query 2 Sorting result SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411547 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(1,2,7,6,8) AND id NOT IN (0) AND date >= '
411548 site_dtl localhost site_dtl Query 2 Sorting result SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411549 site_dtl localhost site_dtl Query 2 Sorting result SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411565 site_dtl localhost site_dtl Query 2 Sorting result SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
approve='1' AND category IN(91) AND id NOT IN (0) AND date >= '2010-11
411618 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(91) AND id NOT IN (0) AND date >= '2010-11
411619 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(80) ORDER BY date DESC LIMIT 0,10
411620 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(91) AND id NOT IN (0) AND date >= '2010-11
411621 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(91) AND id NOT IN (0) AND date >= '2010-11
411622 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(91) AND id NOT IN (0) AND date >= '2010-11
411623 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(91) AND id NOT IN (0) AND date >= '2010-11
411624 site_dtl localhost site_dtl Query 0 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(91) AND id NOT IN (0) AND date >= '2010-11
411625 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(91) AND id NOT IN (0) AND date >= '2010-11
411796 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411797 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37,43,54,55,56,60,61,62,63,64,69,70,71,46,5
411798 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37,43,54,55,56,60,61,62,63,64,69,70,71,46,5
411800 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411801 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411802 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411803 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411804 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411807 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411808 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411809 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411811 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411812 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411813 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411814 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411818 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411819 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411820 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411821 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411822 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411823 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411825 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411826 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411827 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411828 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411829 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(65) AND id NOT IN (0) AND date >= '2010-11
411830 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411831 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411833 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411834 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(48) AND id NOT IN (0) AND date >= '2010-11
411836 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411837 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411838 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411841 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411842 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411843 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411845 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411855 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411856 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' AND date >= '2010-
411857 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411858 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411859 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411860 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411861 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411862 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411863 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411864 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411865 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411866 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411867 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411868 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(37) AND id NOT IN (0) AND date >= '2010-11
411869 site_dtl localhost site_dtl Query 2 Sorting result SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411870 site_dtl localhost site_dtl Query 1 Sending data SELECT COUNT(*) as count FROM dle_post WHERE category regexp '[[:<:]](81)[[:>:]]' AND approve AND da
411871 site_dtl localhost site_dtl Query 2 Sorting result SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411872 site_dtl localhost site_dtl Query 2 Sorting result SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411873 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411874 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411875 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411876 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411877 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411878 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411879 site_dtl localhost site_dtl Query 1 Sending data SELECT COUNT(*) as count FROM dle_post WHERE category regexp '[[:<:]](44|80|81|54|55|60|61|62|63|64|
411890 site_dtl localhost site_dtl Query 1 Sending data SELECT COUNT(*) as count FROM dle_post WHERE category regexp '[[:<:]](44|80|81|54|55|60|61|62|63|64|
411891 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' AND date >= '2010-
411892 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411893 site_dtl localhost site_dtl Query 1 Copying to tmp table SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY RAND() LIM
411894 site_dtl localhost site_dtl Query 1 Sending data SELECT COUNT(*) as count FROM dle_post WHERE category regexp '[[:<:]](44|80|81|54|55|60|61|62|63|64|
411895 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411896 site_dtl localhost site_dtl Query 1 Sending data SELECT COUNT(*) as count FROM dle_post WHERE category regexp '[[:<:]](36|37|43|44|80|81|54|55|60|61|
411897 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411898 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411899 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411900 site_dtl localhost site_dtl Query 1 Locked SELECT * FROM dle_post WHERE approve='1' AND category IN(44,54,55,56,60,61,62,63,64,69,70,71) AND id
411901 site_dtl localhost site_dtl Query 2 Sorting result SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411902 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411903 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411904 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411905 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411907 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411908 site_dtl localhost site_dtl Query 2 Sorting result SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, xfields, title, cat
411909 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411910 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411911 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411912 site_dtl localhost site_dtl Query 1 Locked SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411919 site_dtl localhost site_dtl Query 2 Sorting result SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411921 site_dtl localhost site_dtl Query 2 Sorting result SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411922 site_dtl localhost site_dtl Query 2 Sorting result SELECT id, title, date, alt_name, category, flag FROM dle_post WHERE approve='1' ORDER BY date DESC
411950 root localhost mysql Query 0 --- SHOW PROCESSLIST
====================================================
SHOW CREATE TABLE dle_post\G
*************************** 1. row ***************************
Table: dle_post
Create Table: CREATE TABLE `dle_post` (
`id` int(11) NOT NULL auto_increment,
`autor` varchar(40) NOT NULL default '',
`date` datetime NOT NULL default '0000-00-00 00:00:00',
`short_story` text NOT NULL,
`full_story` text NOT NULL,
`xfields` text NOT NULL,
`title` varchar(255) NOT NULL default '',
`descr` varchar(200) NOT NULL default '',
`keywords` text NOT NULL,
`category` varchar(200) NOT NULL default '0',
`alt_name` varchar(200) NOT NULL default '',
`comm_num` smallint(5) unsigned NOT NULL default '0',
`allow_comm` tinyint(1) NOT NULL default '1',
`allow_main` tinyint(1) unsigned NOT NULL default '1',
`allow_rate` tinyint(1) unsigned NOT NULL default '1',
`approve` tinyint(1) NOT NULL default '0',
`fixed` tinyint(1) NOT NULL default '0',
`rating` smallint(5) NOT NULL default '0',
`allow_br` tinyint(1) NOT NULL default '1',
`vote_num` smallint(5) unsigned NOT NULL default '0',
`news_read` mediumint(8) NOT NULL default '0',
`votes` tinyint(1) NOT NULL default '0',
`access` varchar(150) NOT NULL default '',
`symbol` char(3) NOT NULL default '',
`flag` tinyint(1) NOT NULL default '0',
`editdate` varchar(15) NOT NULL default '',
`editor` varchar(40) NOT NULL default '',
`reason` varchar(255) NOT NULL default '',
`view_edit` tinyint(1) NOT NULL default '0',
`tags` varchar(255) NOT NULL default '',
`metatitle` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`),
KEY `autor` (`autor`),
KEY `alt_name` (`alt_name`),
KEY `category` (`category`),
KEY `approve` (`approve`),
KEY `allow_main` (`allow_main`),
KEY `date` (`date`),
KEY `symbol` (`symbol`),
KEY `comm_num` (`comm_num`),
KEY `tags` (`tags`),
FULLTEXT KEY `short_story` (`short_story`,`full_story`,`xfields`,`title`)
) ENGINE=MyISAM AUTO_INCREMENT=5265 DEFAULT CHARSET=utf8
1 row in set (0.03 sec)
====================================================
SHOW TABLE STATUS LIKE 'dle_post'\G
*************************** 1. row ***************************
Name: dle_post
Engine: MyISAM
Version: 10
Row_format: Dynamic
Rows: 4971
Avg_row_length: 6685
Data_length: 33232848
Max_data_length: 281474976710655
Index_length: 7998464
Data_free: 0
Auto_increment: 5266
Create_time: 2010-04-01 15:21:19
Update_time: 2010-11-14 19:24:19
Check_time: 2010-06-20 01:32:40
Collation: utf8_general_ci
Checksum: NULL
Create_options:
Comment:
1 row in set (0.00 sec)
====================================================
SHOW TABLE STATUS LIKE 'dle_post'\G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: NULL
type: NULL
possible_keys: NULL
key: NULL
key_len: NULL
ref: NULL
rows: NULL
Extra: No tables used
1 row in set (0.00 sec)
====================================================
SHOW VARIABLES LIKE '%buffer%';
+-------------------------------+-----------+
| Variable_name | Value |
+-------------------------------+-----------+
| bulk_insert_buffer_size | 16777216 |
| innodb_buffer_pool_awe_mem_mb | 0 |
| innodb_buffer_pool_size | 8388608 |
| innodb_log_buffer_size | 1048576 |
| join_buffer_size | 3145728 |
| key_buffer_size | 671088640 |
| myisam_sort_buffer_size | 268435456 |
| net_buffer_length | 16384 |
| preload_buffer_size | 32768 |
| read_buffer_size | 3145728 |
| read_rnd_buffer_size | 4194304 |
| sort_buffer_size | 3145728 |
+-------------------------------+-----------+
12 rows in set (0.00 sec)
====================================================
i hope that this information is all required to fix this issue
NOTE : this commands has been executed when the server load 180 - 350
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否有慢查询日志?也发布 EXPLAIN 语句。
对于大表,您的
ORDER BY RAND()
会很慢,有更好的方法,例如 this示例。基本上,您只需生成 0 到 MAX(PRIMARY_KEY) 之间的随机数,然后执行 SELECT * from table WHERE PRIMARY_KEY > @that_random_number LIMIT 1。因此,不要使用 SELECT * from dle_post ORDER BY RAND() LIMIT 1;
执行以下操作:
计算主键的最大值 (auto_increment) 并将其存储在变量中。
SELECT MAX(PRIMARY_ID_COLUMN_NAME) FROM dle_posts LIMIT 1;
生成一个随机数(最好在您的应用程序中避免数据库往返时间,尽管您可以在步骤 1 中通过将 MAX 替换为
FLOOR(RAND() * MAX);
来组合此操作。但是PHP 示例:$chosen = rand(0,$max);
现在获取主键等于或大于该值的第一行:< /p>
从 dle_posts 中选择*,其中 PRIMARY_ID_COLUMN_NAME > $chosen LIMIT 1
(批准、类别、日期)
上的索引有帮助吗?您的慢速查询日志显示没有大问题。如果您可以修改源代码,则可以将以下查询重写
为不使用 now 的查询,但让应用程序填充时间戳。现在查询缓存实际上可以缓存查询。
Do you have a slow query log? Post the EXPLAIN statements too.
Your
ORDER BY RAND()
will be slow for big tables, there are better methods, like this example. Basically you just generate a random number between 0 and MAX(PRIMARY_KEY), then doSELECT * from table WHERE PRIMARY_KEY > @that_random_number LIMIT 1
.So instead of SELECT * from dle_post ORDER BY RAND() LIMIT 1;
Do this:
Calculate the maximum value of your primary key (auto_increment) and store this in a variable.
SELECT MAX(PRIMARY_ID_COLUMN_NAME) FROM dle_posts LIMIT 1;
Generate a random number (best in your application to avoid the database roundtrip time, although you can combine this in step 1 by replacing the MAX by
FLOOR(RAND() * MAX);
. But example in PHP:$chosen = rand(0,$max);
Now get the first row with the primary key equal or bigger than this value:
SELECT * FROM dle_posts WHERE PRIMARY_ID_COLUMN_NAME > $chosen LIMIT 1
Does an index on
(approve, category, date)
help?Your slow Query log shows no big problems. If you can modify the sourcecode, you can rewrite following query:
to a query where you don't use the now, but have your application fill a timestamp. Now the query cache can actually cache the query.