TRUNCATE 中文man頁面
NAME
TRUNCATE - 清空一個表
SYNOPSIS
TRUNCATE [ TABLE ] name
DESCRIPTION 描述
TRUNCATE 快速地從一個表中刪除所有行。它和無條件的 DELETE 有同樣的效果,不過因為它不做表掃描,因而快得多。 在大表上最有用。
PARAMETERS 參數(shù)
- name
要清空的表名字(可以有模式修飾)。
NOTES 注意
如果從其它表有到這個表的外鍵引用,那么就不能使用 TRUNCATE。 在這種情況下檢查有效性要求進行表掃描,而 TRUNCATE 的概念是不做這樣的事情。
TRUNCATE 不會運行任何在該表上存在的 ON DELETE 觸發(fā)器。
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.