不知道为什么一个很简单的表,大约8万多的数据,我想删除之中的7万多条,但是速度奇慢, 语句是 : delete from tb_name where date != 20071203
大虾帮忙看看,在线等结果?
发表于:2007-12-04 13:22:031楼 得分:0
在表上是否有很多的索引?
发表于:2007-12-04 19:34:062楼 得分:0
导出需要保留的约一万条数据,然后replace回那个表试试。 export to file of del select ... load from file of del replace into table nonrecoverable
发表于:2007-12-04 19:36:153楼 得分:0
replace 一样也是要先去删除的
发表于:2007-12-04 20:05:394楼 得分:0
删除数据的话,load replace会比delete快很多。 试试load replace一个空文件到一个有很多数据的表中,就可知道它删除那些数据所花的时间是多少。 alter table table_name activate not logged initially with empty table清空大表也很快。
发表于:2007-12-05 09:22:305楼 得分:0
可以将要保留的数据插入到一个临时表,如 insert into tb_name_tmp select * from tb_name where date = 20071203