wonder about WAL....
drop table big;
CREATE TABLE big(
bid integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
s char(1000)
) WITH (fillfactor = 10);
insert into big(s) values('foo');
checkpoint;
select pg_current_wal_lsn() ;
explain( analyze, costs off, verbose, timing off, buffers,settings, wal,timing off, summary)
delete from big;
select pg_current_wal_lsn() ;
returns:
QUERY PLAN
------------------------------------------------------
Delete on public.big (actual rows=0 loops=1)
Buffers: shared hit=2 dirtied=1
WAL: records=1 fpi=1 bytes=1119
-> Seq Scan on public.big (actual rows=1 loops=1)
Output: ctid
Buffers: shared hit=1 dirtied=1
Settings: search_path = 'public'
Query Identifier: 6906021239059634709
Planning:
Buffers: shared hit=2
Planning Time: 0.155 ms
Execution Time: 0.206 ms
(12 rows)
Parameter | Value
-----------------+-------
wal_compression | off
-----------------+-------
full_page_writes| on
page meta:
select * from page_header(get_raw_page('big',0));
lsn | checksum | flags | lower | upper | special | pagesize | version | prune_xid
------------+----------+-------+-------+-------+---------+----------+---------+-----------
1/D2FB7F90 | 0 | 0 | 28 | 7160 | 8192 | 8192 | 4 | 0
(1 row)
2 lsn position do subtract operation return 1160.
questions:
fpi = 1
means dumped 8192 Bytes to WAL?- What does
WAL: records=1 fpi=1 bytes=1119
1119 bytes mean?
related: https://wiki.postgresql.org/wiki/Full_page_writes
The idea is to switch to "physical" logging for the first modification of each page after a checkpoint, which is a fancy way of saying that we dump the whole 8KB page into the transaction log instead of describing how to change it.