In some cases, we may want to increase the size of the database by inserting random data into the database.
In the script below, we create a table named t_random.
1 | CREATE TABLE t_random AS SELECT s, md5(random()::text) FROM generate_Series(1,5) s; |
We increase the size of the table by inserting some data after the table is created.
1 | INSERT INTO t_random VALUES (generate_series(1,1000000000), md5(random()::text)); |
We can learn the size of the table with the help of the following command.
1 | SELECT pg_size_pretty(pg_relation_size('t_random')); |