NAME
TRUNCATE - 清空一个表
SYNOPSIS
TRUNCATE [ TABLE ] name
DESCRIPTION 描述
TRUNCATE 快速地从一个表中删除所有行。它和无条件的 DELETE 有同样的效果,不过因为它不做表扫描,因而快得多。 在大表上最有用。
PARAMETERS 参数
- name
要清空的表名字(可以有模式修饰)。
NOTES 注意
如果从其它表有到这个表的外键引用,那么就不能使用 TRUNCATE。 在这种情况下检查有效性要求进行表扫描,而 TRUNCATE 的概念是不做这样的事情。
TRUNCATE 不会运行任何在该表上存在的 ON DELETE 触发器。
EXAMPLES 例子
截断表 bigtable∶
TRUNCATE TABLE bigtable;
COMPATIBILITY 兼容性
SQL 标准里没有 TRUNCATE 。
#p#
NAME
TRUNCATE - empty a table
SYNOPSIS
TRUNCATE [ TABLE ] name
DESCRIPTION
TRUNCATE quickly removes all rows from a table. It has the same effect as an unqualified DELETE but since it does not actually scan the table it is faster. This is most useful on large tables.
PARAMETERS
- name
- The name (optionally schema-qualified) of the table to be truncated.
NOTES
TRUNCATE cannot be used if there are foreign-key references to the table from other tables. Checking validity in such cases would require table scans, and the whole point is not to do one.
TRUNCATE will not run any user-defined ON DELETE triggers that might exist for the table.
EXAMPLES
Truncate the table bigtable:
TRUNCATE TABLE bigtable;
COMPATIBILITY
There is no TRUNCATE command in the SQL standard.