1
0

Compare commits

..

3 Commits

Author SHA1 Message Date
7b1465fc4e PostgreSQL 窗口函数 2025-11-05 03:52:35 +08:00
aa2318b5ea PostgreSQL time 2025-11-05 03:52:35 +08:00
1b849b8fa1 PostgreSQL common 2025-11-05 03:52:35 +08:00

View File

@@ -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
-- 看到空间已经回收