From 13623d6ee50794e87ceac37c61e72ba3a92ad8b6 Mon Sep 17 00:00:00 2001 From: David Steele Date: Sun, 23 Jan 2022 13:53:52 -0500 Subject: [PATCH] Create create_test_table() function earlier in user guide. This function (which creates lots of tables) is generally useful for testing (not just stress testing) so create it as soon as the cluster is created. Also add the data parameter which will insert a single row into the table so the file on disk is not zero bytes. --- doc/xml/user-guide.xml | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/doc/xml/user-guide.xml b/doc/xml/user-guide.xml index c132a6bac..5a7e97aa8 100644 --- a/doc/xml/user-guide.xml +++ b/doc/xml/user-guide.xml @@ -1169,6 +1169,22 @@ {[pg-cluster-wait]} + + + psql -c " + create or replace function create_test_table(prefix int, scale int, data bool) returns void as \$\$ + declare + index int; + begin + for index in 1 .. scale loop + execute 'create table test_' || prefix || '_' || index || ' (id int)'; + + if data then + execute 'insert into test_' || prefix || '_' || index || ' values (' || (prefix * index) || ')'; + end if; + end loop; + end \$\$ LANGUAGE plpgsql;" +

When archiving a WAL segment is expected to take more than 60 seconds (the default) to reach the repository, then the archive-timeout option should be increased. Note that this option is not the same as the archive_timeout option which is used to force a WAL segment switch; useful for databases where there are long periods of inactivity. For more information on the archive_timeout option, see Write Ahead Log.

@@ -3433,22 +3449,10 @@ Create tables - - psql -c " - create or replace function create_test_table(prefix int, scale int) returns void as \$\$ - declare - index int; - begin - for index in 1 .. scale loop - execute 'create table test_' || prefix || '_' || index || ' (id int)'; - end loop; - end \$\$ LANGUAGE plpgsql;" - - bash -c 'for i in {1..{[stress-scale-table]}}; - do psql -c "select create_test_table(${i?}, 1000)"; + do psql -c "select create_test_table(${i?}, 1000, true)"; done'