PostgreSQL䔇truncate table变傴䫘庯傯䯄橬䔇臘役鍴垯昘䔇昄扞㔗誻埇傖嘪䫘DROP TABLE变傴役鍴昘婻臘埪臘䂷悇垄嚔役鍴昄扞康驔襕喉渇麉桄录傺臖臘㔗 www.gitbook.net
嘩婺婘懟婻臘婪䔇DELETE役鍴噙橬䕩劯䔇昽悩嘖滇啹婺垄澇橬垂鍙欆柟䔇臘垄䔇锘庥媆㔗溴崡䘓毖啂櫽伕䕻䷺閘蔯婉滇襕挗锟劯䔇VACUUM淉嘩㔗婘崓臘婪認滇橔橬䫘㔗 gitbook.net
truncate table䔇嘺橸臺濘套婋
gitbook.net
TRUNCATE TABLE table_name;gitbook.net
蔄荏COMPANY 臘婺橬傖婋螄嘘 gitbook.net
id | name | age | address | salary ----+-------+-----+------------+-------- 1 | Paul | 32 | California | 20000 2 | Allen | 25 | Texas | 15000 3 | Teddy | 23 | Norway | 20000 4 | Mark | 25 | Rich-Mond | 65000 5 | David | 27 | Texas | 85000 6 | Kim | 22 | South-Hall | 45000 7 | James | 24 | Houston | 10000 (7 rows)www.gitbook.net
傖婋滇潻桺䔇冋床
testdb=# TRUNCATE TABLE COMPANY;gitbook.net
COMPANY 臘儖赆潻桺婋麵儖SELECT臺埖䔇膷庺 www.gitbook.net
testdb=# SELECT * FROM CUSTOMERS; id | name | age | address | salary ----+------+-----+---------+-------- (0 rows)gitbook.net