Compare commits
3 Commits
424b9882bb
...
7b1465fc4e
| Author | SHA1 | Date | |
|---|---|---|---|
| 7b1465fc4e | |||
| aa2318b5ea | |||
| 1b849b8fa1 |
@@ -34,6 +34,23 @@ select r.ctid, r.* from study.r;
|
|||||||
|
|
||||||
-- 删除一条
|
-- 删除一条
|
||||||
delete from study.r where id = 2;
|
delete from study.r where id = 2;
|
||||||
-- 在重新查询,得到
|
-- 再重新查询,得到
|
||||||
-- "(0,1)",1,101
|
-- "(0,1)",1,101
|
||||||
-- "(0,3)",3,103
|
-- "(0,3)",3,103
|
||||||
|
-- PostgreSQL 会保留空槽
|
||||||
|
|
||||||
|
-- 插入新数据
|
||||||
|
insert into study.r values (104, 4);
|
||||||
|
-- 再重新查询,得到
|
||||||
|
-- "(0,1)",1,101
|
||||||
|
-- "(0,3)",3,103
|
||||||
|
-- "(0,4)",4,104
|
||||||
|
-- 可以看到使用了末尾的新槽位,而不是使用中间的新槽位
|
||||||
|
|
||||||
|
-- 执行清理
|
||||||
|
vacuum full study.r;
|
||||||
|
-- 再次扫面,得到
|
||||||
|
-- "(0,1)",1,101
|
||||||
|
-- "(0,2)",3,103
|
||||||
|
-- "(0,3)",4,104
|
||||||
|
-- 看到空间已经回收
|
||||||
|
|||||||
Reference in New Issue
Block a user