PostgreSQL 8.2.3 婺桺桺懼
劯锔媆锔媆誕嬉誕

TRUNCATE

劉䓄

TRUNCATE -- 橙䷺婔婻潡婔䂇臘

臺濘

TRUNCATE [ TABLE ] name [, ...] [ CASCADE | RESTRICT ]

柟誄

TRUNCATE 媆锘婄傯婔幖臘婺役鍴欔橬臯㔗垄启婘懟婻臘婪誕臯方溇傽䔇 DELETE 橬劯湙䔇昽悩婉誺啹婺垄婉啔臘欆柟啹蔯媆冖崔㔗婘崓臘婪橔橬䫘㔗

埗昄

name

襕橙䷺䔇臘劉庖(埇傖橬昇嚟媞閄)

CASCADE

亓蕫橙䷺欔橬婘臖臘婪橬崡髞嚘䫘䔇臘潡蔙䫌庯 CASCADE 蔯赆時媹彄䂇婺䔇臘㔗

RESTRICT

套悩噽傡臘婘臖臘婪橬崡髞嚘䫘彍拐䂺橙䷺㔗認滇䚺䩕㔗

濘懟

埻橬臘䔇欔橬蔙埇傖 TRUNCATE 垄㔗

套悩傯噽垄臘橬彄昊婻臘䔇崡髞嚘䫘闼幽儌婉脘凹臖臘嘪䫘 TRUNCATE 鍴麂認底臘婘劯婔婻变傴婺幘赆橙䷺㔗婘認䓉愙喕婋演昖橬昽攓襕挗誕臯臘欆柟蔯 TRUNCATE 幽婉啔認湙䔇庋愙㔗CASCADE 锬釹埇傖䫘庯亓蕫寙劆欔橬冺蕡臘嘖滇嘪䫘溴锬亪媙釂剕彖償媄劥彍埇脘婵崌寘橸婉愿婵崌䔇昄扞㔗

TRUNCATE 婉嚔誊臯傂嘘婘臖臘婪䔇 ON DELETE 蓥埏単㔗

冋床

橙䷺ bigtablefattable 臘

TRUNCATE TABLE bigtable, fattable;

橙䷺ othertable 臘幽婫亓蕫橙䷺欔橬锔誺崡髞亥溘嚘䫘 othertable 䔇臘

TRUNCATE othertable CASCADE;

噚垹攓

SQL 湺庖麯澇橬 TRUNCATE 变傴㔗


劯锔饡釕嬉誕
START TRANSACTION婪婔亓UNLISTEN