truncate.7
来自「PostgreSQL 8.2中增加了很多企业用户所需要的功能和性能上的提高,其开」· 7 代码 · 共 65 行
7
65 行
.\\" auto-generated by docbook2man-spec $Revision: 1.1.1.1 $.TH "TRUNCATE" "" "2008-01-03" "SQL - Language Statements" "SQL Commands".SH NAMETRUNCATE \- empty a table or set of tables.SH SYNOPSIS.sp.nfTRUNCATE [ TABLE ] \fIname\fR [, ...] [ CASCADE | RESTRICT ].sp.fi.SH "DESCRIPTION".PP\fBTRUNCATE\fR quickly removes all rows from a set oftables. It has the same effect as an unqualified\fBDELETE\fR on each table, but since it does not actuallyscan the tables it is faster. This is most useful on large tables..SH "PARAMETERS".TP\fB\fIname\fB\fRThe name (optionally schema-qualified) of a table to be truncated..TP\fBCASCADE\fRAutomatically truncate all tables that have foreign-key referencesto any of the named tables, or to any tables added to the groupdue to CASCADE..TP\fBRESTRICT\fRRefuse to truncate if any of the tables have foreign-key referencesfrom tables that are not to be truncated. This is the default..SH "NOTES".PPOnly the owner of a table may \fBTRUNCATE\fR it..PP\fBTRUNCATE\fR cannot be used on a table that has foreign-keyreferences from other tables, unless all such tables are also truncatedin the same command. Checking validity in such cases would require tablescans, and the whole point is not to do one. The CASCADEoption can be used to automatically include all dependent tables \(embut be very careful when using this option, else you might lose data youdid not intend to!.PP\fBTRUNCATE\fR will not run any user-defined ONDELETE triggers that might exist for the tables..SH "EXAMPLES".PPTruncate the tables bigtable and fattable:.sp.nfTRUNCATE TABLE bigtable, fattable;.sp.fi.PPTruncate the table othertable, and cascade to any tablesthat are referencing othertable via foreign-keyconstraints:.sp.nfTRUNCATE othertable CASCADE;.sp.fi.SH "COMPATIBILITY".PPThere is no \fBTRUNCATE\fR command in the SQL standard.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?