- 论坛徽章:
- 0
|
[mysqld]
port = 3311
socket = /tmp/mysql.sock
datadir = /opt/mysql
max_connections = 512
max_connect_errors = 10000000
log = /data/mysql/mysqld_common.log
log-error = /data/mysql/mysqld_err.log
#skip-locking
#key_buffer_size = 16M
#max_allowed_packet = 1M
#table_open_cache = 64
#sort_buffer_size = 512K
#net_buffer_length = 8K
#read_buffer_size = 256K
#read_rnd_buffer_size = 512K
#event_scheduler = 1
key_buffer_size = 512M
max_allowed_packet = 16M
table_open_cache = 2048
sort_buffer_size = 8M
read_buffer_size = 8M
read_rnd_buffer_size = 128M
myisam_sort_buffer_size = 128M
thread_cache_size = 8
query_cache_size = 128M
#log-bin=mysql-bin
long_query_time = 0.5
expire-logs-days = 3
log-slow-queries=/data/mysql/slowquery.log
#binlog-do-db = jmh
#innodb_buffer_pool_size = 512M
innodb_buffer_pool_size = 3G
table_cache = 2048
#innodb_log_file_size = 128M
innodb_log_file_size = 256M
innodb_log_buffer_size = 16M
innodb_flush_log_at_trx_commit = 2
#DEFAULT-CHARACTER-SET = utf8
innodb_thread_concurrency = 4
character_set_server = utf8
log_bin_trust_function_creators = 1
replicate-ignore-db = mysql
wait-timeout = 1800
innodb_data_file_path = ibdata1:10M:autoextend
CREATE TABLE `TIMELINE_ITEM_HOME_74` (
`TLID` bigint(16) NOT NULL,
`OWNUNO` varchar(36) NOT NULL,
`TLDOMAIN` varchar(32) NOT NULL,
`TLCONTENTTYPE` varchar(32) NOT NULL,
`DIRECTUNO` varchar(36) NOT NULL,
`DIRECTID` varchar(36) NOT NULL,
`PARENTUNO` varchar(36) DEFAULT NULL,
`PARENTID` varchar(36) DEFAULT NULL,
`RELATIONUNO` varchar(36) DEFAULT NULL,
`RELATIONID` varchar(36) DEFAULT NULL,
`FILTERTYPE` int(11) NOT NULL DEFAULT '1' COMMENT '过滤类型',
`TLDESCRIPTION` varchar(12 DEFAULT NULL,
`CREATEDATE` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`REMOVESTATUS` varchar(32) NOT NULL,
`REMOVEDATE` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`TLID`) USING BTREE,
UNIQUE KEY `IDX_TLI_HOME_74_UNIQUE` (`OWNUNO`,`DIRECTID`) USING BTREE,
KEY `IDX_TLI_HOME_74_CREATEDATE` (`CREATEDATE`) USING BTREE,
KEY `IDX_TLI_HOME_74_REMOVE_UNO` (`REMOVESTATUS`,`OWNUNO`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
TIMELINE_ITEM_HOME_74 0 PRIMARY 1 TLID A 1485352 \N \N BTREE
TIMELINE_ITEM_HOME_74 0 IDX_TLI_HOME_74_UNIQUE 1 OWNUNO A \N \N \N BTREE
TIMELINE_ITEM_HOME_74 0 IDX_TLI_HOME_74_UNIQUE 2 DIRECTID A 1485352 \N \N BTREE
TIMELINE_ITEM_HOME_74 1 IDX_TLI_HOME_74_CREATEDATE 1 CREATEDATE A 4612 \N \N BTREE
TIMELINE_ITEM_HOME_74 1 IDX_TLI_HOME_74_REMOVE_UNO 1 REMOVESTATUS A 2 \N \N BTREE
TIMELINE_ITEM_HOME_74 1 IDX_TLI_HOME_74_REMOVE_UNO 2 OWNUNO A 21 \N \N BTREE
[root@web002 mysql]# mysqldumpslow -t 20 slowquery.log
Reading mysql slow query log from slowquery.log
Count: 3 Time=348.40s (1045s) Lock=0.04s (0s) Rows=1.0 (3), timelinero[timelinero]@[172.16.75.82]
SELECT COUNT(N) FROM TIMELINE_ITEM_HOME_49 WHERE OWNUNO = 'S' AND REMOVESTATUS = 'S'
Count: 1 Time=280.57s (280s) Lock=0.00s (0s) Rows=50.0 (50), timelinero[timelinero]@[172.16.75.82]
SELECT * FROM TIMELINE_ITEM_HOME_11 WHERE OWNUNO = 'S' AND REMOVESTATUS = 'S' ORDER BY CREATEDATE DESC LIMIT N, N
Count: 1 Time=273.89s (273s) Lock=0.00s (0s) Rows=50.0 (50), timelinero[timelinero]@[172.16.75.82]
SELECT * FROM TIMELINE_ITEM_HOME_03 WHERE OWNUNO = 'S' AND REMOVESTATUS = 'S' ORDER BY CREATEDATE DESC LIMIT N, N
Count: 2 Time=220.69s (441s) Lock=0.00s (0s) Rows=50.0 (100), timelinero[timelinero]@[172.16.75.82]
SELECT * FROM TIMELINE_ITEM_HOME_29 WHERE OWNUNO = 'S' AND REMOVESTATUS = 'S' ORDER BY CREATEDATE DESC LIMIT N, N
以上是基本信息,现在问题就在TIMELINE一个语句要100到300秒的时间,数据在100W到200W之间,不知道怎么才能再进行优化了,之前问过问题,没有解决,机器配置是dell的R310,4G内存,硬盘7200转没做RAID,测试环境这个是,下面是执行计划
EXPLAIN SELECT * FROM TIMELINE_ITEM_HOME_74 WHERE OWNUNO = '49652ece-bc1e-4ef0-928b-8085a4f9a4dd' AND REMOVESTATUS = 'n' ORDER BY CREATEDATE DESC LIMIT 0,50;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE TIMELINE_ITEM_HOME_74 ref IDX_TLI_HOME_74_UNIQUE,IDX_TLI_HOME_74_REMOVE_UNO IDX_TLI_HOME_74_UNIQUE 110 const 2683 Using where; Using filesort
现在真的没有头绪要怎么办了,请教大家帮忙想想,在线等,谢谢!! |
|