1
0

Compare commits

..

3 Commits

Author SHA1 Message Date
424b9882bb PostgreSQL 窗口函数 2025-11-04 21:45:04 +08:00
c46757f76f PostgreSQL time 2025-11-04 21:45:04 +08:00
15b1c485d2 PostgreSQL common 2025-11-04 21:45:04 +08:00

View File

@@ -34,23 +34,6 @@ 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
-- 看到空间已经回收