如何用一条语句删除一个表的全部记录?

给第一个给出答案的人
---------------------------------------------------------------

truncate table 表名
---------------------------------------------------------------

delete from 表名;完全能解决问题。
---------------------------------------------------------------

truncate 不能rollback
delete可以
---------------------------------------------------------------

但是(delete from 表名) 比 (truncate table 表名) 速度要慢很多!
---------------------------------------------------------------

create or replace old_table as select * from table_name where 1=2;

---------------------------------------------------------------

truncate 会reset表的HWM(high water mark) , 这样一来,查询速度就快了

Published At
Categories with 数据库类
Tagged with
comments powered by Disqus