ysql> status
--------------
mysql Ver 14.7 Distrib 4.1.20, for redhat-linux-gnu (i386) using readline 4.3
Connection id: 19212
Current database: information_schema
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.1.14-beta-log
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: utf8
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /data/mysql/mysql.sock
Uptime: 4 days 9 hours 24 min 2 sec
Threads: 130 Questions: 508391673 Slow queries: 606 Opens: 966 Flush tables: 1 Open tables: 959 Queries per second avg: %
--------------
insert into mo_new.check_data_log ( select distinct t1.nCheckdataLogID,t1.nCheckpointID,t1.fValue,t1.dtGetdatetime,t1.nCheckOK,t1.SubClassWord,t1.ValueWord from check_data_log t1 left join checkpoint t2 on t2.ncheckpointid where t2.nunitid in ( '7','12','13','19','21','22','45' ));
insert into mo_new.check_data_log ( select distinct t1.nCheckdataLogID,t1.nCheckpointID,t1.fValue,t1.dtGetdatetime,t1.nCheckOK,t1.SubClassWord,t1.ValueWord from check_data_log t1 left join checkpoint t2 on t2.ncheckpointid where t2.nunitid in ( '7','12','13','19','21','22','45' ));
你把所有的SQL都贴出来,才知道怎么帮你分区和优化
PS:
select * from check_data_log where dtGetdatetime='2007-04-11 19:53:57';这个用不到索引,所以慢
insert into mo_new.check_data_log ( select distinct t1.nCheckdataLogID,t1.nCheckpointID,t1.fValue,t1.dtGetdatetime,t1.nCheckOK,t1.SubClassWord,t1.ValueWord from check_data_log t1 left join checkpoint t2 on t2.ncheckpointid where t2.nunitid in ( '7','12','13','19','21','22','45' ));