Skip to content

Commit 2fca2c0

Browse files
committed
Add -F option to set fillfactor for tellers, accounts and branches.
Patch contributed by Pavan Deolasee. Along with Japanese doc modification by Tatsuo Ishii.
1 parent c218c0b commit 2fca2c0

File tree

3 files changed

+52
-11
lines changed

3 files changed

+52
-11
lines changed

contrib/pgbench/README.pgbench

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$PostgreSQL: pgsql/contrib/pgbench/README.pgbench,v 1.17 2007/04/06 09:16:15 ishii Exp $
1+
$PostgreSQL: pgsql/contrib/pgbench/README.pgbench,v 1.18 2007/04/08 01:15:07 ishii Exp $
22

33
pgbench README
44

@@ -57,8 +57,9 @@ o How to use pgbench?
5757
accounts 100000
5858
history 0
5959

60-
You can increase the number of tuples by using -s option. See
61-
below.
60+
You can increase the number of tuples by using -s option. branches,
61+
tellers and accounts tables are created with a fillfactor which is
62+
set using -F option. See below.
6263

6364
(2) Run the benchmark test
6465

@@ -162,6 +163,12 @@ o options
162163
0 201 2513 0 1175850569 608
163164
0 202 2038 0 1175850569 2663
164165

166+
-F fillfactor
167+
168+
Create tables(accounts, tellers and branches) with the given
169+
fillfactor. Default is 100. This should be used with -i
170+
(initialize) option.
171+
165172
-d
166173
debug option.
167174

contrib/pgbench/README.pgbench_jis

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$PostgreSQL: pgsql/contrib/pgbench/README.pgbench_jis,v 1.18 2007/04/06 09:16:16 ishii Exp $
1+
$PostgreSQL: pgsql/contrib/pgbench/README.pgbench_jis,v 1.19 2007/04/08 01:15:07 ishii Exp $
22

33
pgbench README
44

@@ -155,6 +155,11 @@ pgbench $B$K$O$$$m$$$m$J%*%W%7%g%s$,$"$j$^$9!%(B
155155
0 201 2513 0 1175850569 608
156156
0 202 2038 0 1175850569 2663
157157

158+
-F $B%U%#%k%U%!%/%?!<(B
159+
accounts, tellers, bracnhes$B%F!<%V%k$r:n@.$9$k:]$K;XDj$5$l$?%U%#(B
160+
$B%k%U%!%/%?!<$r;HMQ$7$^$9!%%U%#%k%U%!%/%?!<$N%G%U%)%k%H$O(B100$B$G(B
161+
$B$9!%$3$N%*%W%7%g%s$O(B -i $B%*%W%7%g%s$HF1;~$K;HMQ$7$^$9!%(B
162+
158163
-d $B%G%P%C%0%*%W%7%g%s!%MM!9$J>pJs$,I=<($5$l$^$9!%(B
159164

160165
$B"#%G!<%?%Y!<%9$N=i4|2=(B

contrib/pgbench/pgbench.c

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.64 2007/04/06 09:16:16 ishii Exp $
2+
* $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.65 2007/04/08 01:15:07 ishii Exp $
33
*
44
* pgbench: a simple benchmark program for PostgreSQL
55
* written by Tatsuo Ishii
@@ -64,6 +64,12 @@ int nxacts = 10; /* default number of transactions per clients */
6464
*/
6565
int scale = 1;
6666

67+
/*
68+
* fillfactor. for example, fillfactor = 90 will use only 90 percent
69+
* space during inserts and leave 10 percent free.
70+
*/
71+
int fillfactor = 100;
72+
6773
/*
6874
* end of configurable parameters
6975
*********************************************************************/
@@ -178,7 +184,7 @@ static void
178184
usage(void)
179185
{
180186
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");
181-
fprintf(stderr, "(initialize mode): pgbench -i [-h hostname][-p port][-s scaling_factor][-U login][-P password][-d][dbname]\n");
187+
fprintf(stderr, "(initialize mode): pgbench -i [-h hostname][-p port][-s scaling_factor] [-F fillfactor] [-U login][-P password][-d][dbname]\n");
182188
}
183189

184190
/* random number generator */
@@ -730,11 +736,11 @@ init(void)
730736
PGresult *res;
731737
static char *DDLs[] = {
732738
"drop table if exists branches",
733-
"create table branches(bid int not null,bbalance int,filler char(88))",
739+
"create table branches(bid int not null,bbalance int,filler char(88)) with (fillfactor=%d)",
734740
"drop table if exists tellers",
735-
"create table tellers(tid int not null,bid int,tbalance int,filler char(84))",
741+
"create table tellers(tid int not null,bid int,tbalance int,filler char(84)) with (fillfactor=%d)",
736742
"drop table if exists accounts",
737-
"create table accounts(aid int not null,bid int,abalance int,filler char(84))",
743+
"create table accounts(aid int not null,bid int,abalance int,filler char(84)) with (fillfactor=%d)",
738744
"drop table if exists history",
739745
"create table history(tid int,bid int,aid int,delta int,mtime timestamp,filler char(22))"};
740746
static char *DDLAFTERs[] = {
@@ -751,7 +757,22 @@ init(void)
751757
exit(1);
752758

753759
for (i = 0; i < lengthof(DDLs); i++)
754-
executeStatement(con, DDLs[i]);
760+
{
761+
/*
762+
* set fillfactor for branches, tellers and accounts tables
763+
*/
764+
if ((strstr(DDLs[i], "create table branches") == DDLs[i]) ||
765+
(strstr(DDLs[i], "create table tellers") == DDLs[i]) ||
766+
(strstr(DDLs[i], "create table accounts") == DDLs[i]))
767+
{
768+
char ddl_stmt[128];
769+
snprintf(ddl_stmt, 128, DDLs[i], fillfactor);
770+
executeStatement(con, ddl_stmt);
771+
continue;
772+
}
773+
else
774+
executeStatement(con, DDLs[i]);
775+
}
755776

756777
executeStatement(con, "begin");
757778

@@ -1153,7 +1174,7 @@ main(int argc, char **argv)
11531174

11541175
memset(state, 0, sizeof(*state));
11551176

1156-
while ((c = getopt(argc, argv, "ih:nvp:dc:t:s:U:P:CNSlf:D:")) != -1)
1177+
while ((c = getopt(argc, argv, "ih:nvp:dc:t:s:U:P:CNSlf:D:F:")) != -1)
11571178
{
11581179
switch (c)
11591180
{
@@ -1258,6 +1279,14 @@ main(int argc, char **argv)
12581279
}
12591280
}
12601281
break;
1282+
case 'F':
1283+
fillfactor = atoi(optarg);
1284+
if ((fillfactor < 10) || (fillfactor > 100))
1285+
{
1286+
fprintf(stderr, "invalid fillfactor: %d\n", fillfactor);
1287+
exit(1);
1288+
}
1289+
break;
12611290
default:
12621291
usage();
12631292
exit(1);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy