Index: README.pgbench =================================================================== RCS file: /home/cvs/postgres/cvs/pgsql/contrib/pgbench/README.pgbench,v retrieving revision 1.17 diff -c -r1.17 README.pgbench *** README.pgbench 6 Apr 2007 09:16:15 -0000 1.17 --- README.pgbench 7 Apr 2007 16:42:45 -0000 *************** *** 57,64 **** accounts 100000 history 0 ! You can increase the number of tuples by using -s option. See ! below. (2) Run the benchmark test --- 57,65 ---- accounts 100000 history 0 ! You can increase the number of tuples by using -s option. branches, ! tellers and accounts tables are created with a fillfactor which is ! set using -F option. See below. (2) Run the benchmark test *************** *** 162,167 **** --- 163,172 ---- 0 201 2513 0 1175850569 608 0 202 2038 0 1175850569 2663 + -F fillfactor + Create tables with the given fillfactor. Default is 100. + This should be used with -i (initialize) option. + -d debug option. Index: pgbench.c =================================================================== RCS file: /home/cvs/postgres/cvs/pgsql/contrib/pgbench/pgbench.c,v retrieving revision 1.64 diff -c -r1.64 pgbench.c *** pgbench.c 6 Apr 2007 09:16:16 -0000 1.64 --- pgbench.c 7 Apr 2007 16:42:45 -0000 *************** *** 65,70 **** --- 65,76 ---- int scale = 1; /* + * fillfactor. for example, fillfactor = 90 will use only 90 percent + * space during inserts and leave 10 percent free. + */ + int fillfactor = 100; + + /* * end of configurable parameters *********************************************************************/ *************** *** 178,184 **** usage(void) { fprintf(stderr, "usage: pgbench [-h hostname][-p port][-c nclients][-t ntransactions][-s scaling_factor][-D varname=value][-n][-C][-v][-S][-N][-f filename][-l][-U login][-P password][-d][dbname]\n"); ! fprintf(stderr, "(initialize mode): pgbench -i [-h hostname][-p port][-s scaling_factor][-U login][-P password][-d][dbname]\n"); } /* random number generator */ --- 184,190 ---- usage(void) { fprintf(stderr, "usage: pgbench [-h hostname][-p port][-c nclients][-t ntransactions][-s scaling_factor][-D varname=value][-n][-C][-v][-S][-N][-f filename][-l][-U login][-P password][-d][dbname]\n"); ! fprintf(stderr, "(initialize mode): pgbench -i [-h hostname][-p port][-s scaling_factor] [-F fillfactor] [-U login][-P password][-d][dbname]\n"); } /* random number generator */ *************** *** 730,740 **** PGresult *res; static char *DDLs[] = { "drop table if exists branches", ! "create table branches(bid int not null,bbalance int,filler char(88))", "drop table if exists tellers", ! "create table tellers(tid int not null,bid int,tbalance int,filler char(84))", "drop table if exists accounts", ! "create table accounts(aid int not null,bid int,abalance int,filler char(84))", "drop table if exists history", "create table history(tid int,bid int,aid int,delta int,mtime timestamp,filler char(22))"}; static char *DDLAFTERs[] = { --- 736,746 ---- PGresult *res; static char *DDLs[] = { "drop table if exists branches", ! "create table branches(bid int not null,bbalance int,filler char(88)) with (fillfactor=%d)", "drop table if exists tellers", ! "create table tellers(tid int not null,bid int,tbalance int,filler char(84)) with (fillfactor=%d)", "drop table if exists accounts", ! "create table accounts(aid int not null,bid int,abalance int,filler char(84)) with (fillfactor=%d)", "drop table if exists history", "create table history(tid int,bid int,aid int,delta int,mtime timestamp,filler char(22))"}; static char *DDLAFTERs[] = { *************** *** 751,757 **** exit(1); for (i = 0; i < lengthof(DDLs); i++) ! executeStatement(con, DDLs[i]); executeStatement(con, "begin"); --- 757,778 ---- exit(1); for (i = 0; i < lengthof(DDLs); i++) ! { ! /* ! * set fillfactor for branches, tellers and accounts tables ! */ ! if ((strstr(DDLs[i], "create table branches") == DDLs[i]) || ! (strstr(DDLs[i], "create table tellers") == DDLs[i]) || ! (strstr(DDLs[i], "create table accounts") == DDLs[i])) ! { ! char ddl_stmt[128]; ! snprintf(ddl_stmt, 128, DDLs[i], fillfactor); ! executeStatement(con, ddl_stmt); ! continue; ! } ! else ! executeStatement(con, DDLs[i]); ! } executeStatement(con, "begin"); *************** *** 1153,1159 **** memset(state, 0, sizeof(*state)); ! while ((c = getopt(argc, argv, "ih:nvp:dc:t:s:U:P:CNSlf:D:")) != -1) { switch (c) { --- 1174,1180 ---- memset(state, 0, sizeof(*state)); ! while ((c = getopt(argc, argv, "ih:nvp:dc:t:s:U:P:CNSlf:D:F:")) != -1) { switch (c) { *************** *** 1258,1263 **** --- 1279,1292 ---- } } break; + case 'F': + fillfactor = atoi(optarg); + if ((fillfactor < 10) || (fillfactor > 100)) + { + fprintf(stderr, "invalid fillfactor: %d\n", fillfactor); + exit(1); + } + break; default: usage(); exit(1);