Skip to content

Commit f82d4d5

Browse files
committed
pgbench has #defines for number of branches, tellers, and accounts. There
are used to populate the tables with -i, but when running actual benchmark it has values separately hard-coded in the query metacommands. This patch makes the metacommands obtain their values from the relevant #defines. Patch provided by Jeff Janes.
1 parent 4e2d5ef commit f82d4d5

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

contrib/pgbench/pgbench.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* A simple benchmark program for PostgreSQL
55
* Originally written by Tatsuo Ishii and enhanced by many contributors.
66
*
7-
* $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.90 2009/08/03 18:30:55 tgl Exp $
7+
* $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.91 2009/09/10 13:59:57 ishii Exp $
88
* Copyright (c) 2000-2009, PostgreSQL Global Development Group
99
* ALL RIGHTS RESERVED;
1010
*
@@ -132,7 +132,7 @@ int fillfactor = 100;
132132
* end of configurable parameters
133133
*********************************************************************/
134134

135-
#define nbranches 1
135+
#define nbranches 1 /* Makes little sense to change this. Change -s instead */
136136
#define ntellers 10
137137
#define naccounts 100000
138138

@@ -232,9 +232,9 @@ static int debug = 0; /* debug flag */
232232

233233
/* default scenario */
234234
static char *tpc_b = {
235-
"\\set nbranches :scale\n"
236-
"\\set ntellers 10 * :scale\n"
237-
"\\set naccounts 100000 * :scale\n"
235+
"\\set nbranches " CppAsString2(nbranches) " * :scale\n"
236+
"\\set ntellers " CppAsString2(ntellers) " * :scale\n"
237+
"\\set naccounts " CppAsString2(naccounts) " * :scale\n"
238238
"\\setrandom aid 1 :naccounts\n"
239239
"\\setrandom bid 1 :nbranches\n"
240240
"\\setrandom tid 1 :ntellers\n"
@@ -250,9 +250,9 @@ static char *tpc_b = {
250250

251251
/* -N case */
252252
static char *simple_update = {
253-
"\\set nbranches :scale\n"
254-
"\\set ntellers 10 * :scale\n"
255-
"\\set naccounts 100000 * :scale\n"
253+
"\\set nbranches " CppAsString2(nbranches) " * :scale\n"
254+
"\\set ntellers " CppAsString2(ntellers) " * :scale\n"
255+
"\\set naccounts " CppAsString2(naccounts) " * :scale\n"
256256
"\\setrandom aid 1 :naccounts\n"
257257
"\\setrandom bid 1 :nbranches\n"
258258
"\\setrandom tid 1 :ntellers\n"
@@ -266,7 +266,7 @@ static char *simple_update = {
266266

267267
/* -S case */
268268
static char *select_only = {
269-
"\\set naccounts 100000 * :scale\n"
269+
"\\set naccounts " CppAsString2(naccounts) " * :scale\n"
270270
"\\setrandom aid 1 :naccounts\n"
271271
"SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n"
272272
};

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