Will the table occupies more storage space after updates?
Redrock Postgres implemented in-place updates by introducing undo logs and marking index records deleted, and reuse space immediately after a transaction commit that performs a delete or non-in-place update. Therefore, after table data is updated, no more storage space is occupied.
Create a table, insert some data, and update the table data, then check whether the storage space occupied by the table changes after the update.
CREATE TABLE t_large (id integer, name text); INSERT INTO t_large (id, name) SELECT i, 'xxx' FROM generate_series(1, 1000000) AS s(i); SELECT pg_size_pretty(pg_table_size('t_large')); pg_size_pretty ---------------- 19 MB UPDATE t_large SET id = id - 1, name = 'yyy'; SELECT pg_size_pretty(pg_table_size('t_large')); pg_size_pretty ---------------- 19 MB
In the above example, the storage space occupied by the
t_large table does not change after the table is updated.