clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 1044276 fiddles created (9443 in the last week).

create table demo as with q as (select 42 x union all select 42) select 42 x from q a cross join q b cross join q c cross join q d cross join q e cross join q f cross join q g cross join q h cross join q i cross join q j cross join q k cross join q l cross join q m cross join q n cross join q o cross join q p cross join q r cross join q s cross join q t cross join q u
1048576 rows affected
 hidden batch(es)


select pg_size_pretty( pg_total_relation_size('demo') );
pg_size_pretty
36 MB
 hidden batch(es)


-- adding a column does not add space :) alter table demo add column b numeric ;
 hidden batch(es)


select pg_size_pretty( pg_total_relation_size('demo') );
pg_size_pretty
36 MB
 hidden batch(es)


-- even with a default value in it :)) alter table demo add c numeric default 42 not null;
 hidden batch(es)


select pg_size_pretty( pg_total_relation_size('demo') );
pg_size_pretty
36 MB
 hidden batch(es)


-- proof that table would grow if it updates the rows update demo set b=42;
1048576 rows affected
 hidden batch(es)


select pg_size_pretty( pg_total_relation_size('demo') );
pg_size_pretty
81 MB
 hidden batch(es)