vacuum使用

https://blog.csdn.net/cuichao1900/article/details/100394801

ExecVacuum->vacuum->vacuum_rel->heap_vacuum_rel->lazy_scan_heap->lazy_vacuum_index函数的实现逻辑,该函数清理index relation

【测试流程】

postgres=# create table t2(id int,c1  varchar(40));
postgres=# insert into t2(id, c1) values(1,‘a‘);
INSERT 0 1
postgres=# select * from heap_page_items(get_raw_page(‘t2‘,0)) limit 10;
 lp | lp_off | lp_flags | lp_len | t_xmin | t_xmax | t_field3 | t_ctid | t_infomask2 | t_infomask | t_hoff | t_bits | t_oid |     t_data     
----+--------+----------+--------+--------+--------+----------+--------+-------------+------------+--------+--------+-------+----------------
  1 |   8160 |        1 |     30 |    579 |      0 |        0 | (0,1)  |           2 |       2050 |     24 |        |       | \x010000000561
(1 row)

postgres=# update t2 set c1=‘b‘ where id=1;
UPDATE 1
postgres=# select * from heap_page_items(get_raw_page(‘t2‘,0)) limit 10;
 lp | lp_off | lp_flags | lp_len | t_xmin | t_xmax | t_field3 | t_ctid | t_infomask2 | t_infomask | t_hoff | t_bits | t_oid |     t_data     
----+--------+----------+--------+--------+--------+----------+--------+-------------+------------+--------+--------+-------+----------------
  1 |   8160 |        1 |     30 |    579 |    580 |        0 | (0,2)  |       16386 |        258 |     24 |        |       | \x010000000561
  2 |   8128 |        1 |     30 |    580 |      0 |        0 | (0,2)  |       32770 |      10242 |     24 |        |       | \x010000000562
(2 rows)

postgres=# vacuum t2;
VACUUM
postgres=# select * from heap_page_items(get_raw_page(‘t2‘,0)) limit 10;
 lp | lp_off | lp_flags | lp_len | t_xmin | t_xmax | t_field3 | t_ctid | t_infomask2 | t_infomask | t_hoff | t_bits | t_oid |     t_data     
----+--------+----------+--------+--------+--------+----------+--------+-------------+------------+--------+--------+-------+----------------
  1 |      2 |        2 |      0 |        |        |          |        |             |            |        |        |       | 
  2 |   8160 |        1 |     30 |    580 |      0 |        0 | (0,2)  |       32770 |      10498 |     24 |        |       | \x010000000562

vacuum使用

上一篇:获取浏览器数据


下一篇:记录运行vue文件项目时报错问题解决方案