vacuum-wal-usage.sql

text/plain

Filename: vacuum-wal-usage.sql
Type: text/plain
Part: 2
Message: lazy_vacuum_heap()'s removal of HEAPTUPLE_DEAD tuples
\timing on

begin;
drop schema if exists vactest cascade;
create schema vactest;
set search_path = vactest;

create type tidrec AS (blk int, posid int);
create table t (c) as select * from generate_series(1,5000000);
alter table t add primary key (c);
create table walpos (c text);
commit;

begin;
delete from t where (ctid::text::tidrec).posid = 10;
insert into walpos values (pg_current_xlog_insert_location());
commit;

vacuum verbose t;

begin;
select pg_xlog_location_diff(pg_current_xlog_insert_location(), c) FROM walpos;
reset search_path;
commit;