赞
踩
作者:瀚高PG实验室 (Highgo PG Lab)
mydb=# create table tbl_kenyon(id int,cname varchar(50),remark text); CREATE TABLE mydb=# insert into tbl_kenyon select generate_series(1,10000000),'kenyon good boy',md5('kenyon good boy'); INSERT 0 10000000 mydb=# insert into tbl_kenyon select generate_series(1,10000000),'kenyon good boy',md5('kenyon good boy'); INSERT 0 10000000 mydb=# select pg_size_pretty(pg_relation_size('tbl_kenyon')); pg_size_pretty ---------------- 1611 MB (1 row) [highgo@hgdb 4.1.1]$ du -sh 6.2G . mydb=# select pg_relation_filepath('tbl_kenyon'); pg_relation_filepath ---------------------- base/32996/57990 (1 row) [highgo@hgdb base]$ ll 32996/57990* -rw------- 1 highgo highgo 1073741824 Feb 24 10:57 32996/57990 -rw------- 1 highgo highgo 615333888 Feb 24 10:57 32996/57990.1 -rw------- 1 highgo highgo 434176 Feb 24 10:51 32996/57990_fsm mydb=# drop table tbl_kenyon ; DROP TABLE [highgo@hgdb base]$ ll 32996/57990* -rw------- 1 highgo highgo 0 Feb 24 10:58 32996/57990 [highgo@hgdb 4.1.1]$ du -sh 4.6G .
从上面的内容可以看出,drop table 会直接释放空间
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。