Hi,
I have made patches to change the delta val from 0 and 10000 to -5000
and 5000 per recent discussion in hackers list. Also I have enhanced
predefined benchmark scenarios to reflect the scaling factor parameter
flexibly.
If there's no objection, I will commit by the end of this week.
--
Tatsuo Ishii
SRA OSS, Inc. Japan
Index: pgbench.c
===================================================================
RCS file: /cvsroot/pgsql/contrib/pgbench/pgbench.c,v
retrieving revision 1.50
diff -c -r1.50 pgbench.c
*** pgbench.c 26 Jul 2006 07:24:50 -0000 1.50
--- pgbench.c 27 Jul 2006 05:52:18 -0000
***************
*** 134,143 ****
/* default scenario */
static char *tpc_b = {
! "\\setrandom aid 1 100000\n"
! "\\setrandom bid 1 1\n"
! "\\setrandom tid 1 10\n"
! "\\setrandom delta 1 10000\n"
"BEGIN;\n"
"UPDATE accounts SET abalance = abalance + :delta WHERE aid = :aid;\n"
"SELECT abalance FROM accounts WHERE aid = :aid;\n"
--- 134,146 ----
/* default scenario */
static char *tpc_b = {
! "\\set nbranches :tps\n"
! "\\set ntellers 10 * :tps\n"
! "\\set naccounts 100000 * :tps\n"
! "\\setrandom aid 1 :naccounts\n"
! "\\setrandom bid 1 :nbranches\n"
! "\\setrandom tid 1 :ntellers\n"
! "\\setrandom delta -5000 5000\n"
"BEGIN;\n"
"UPDATE accounts SET abalance = abalance + :delta WHERE aid = :aid;\n"
"SELECT abalance FROM accounts WHERE aid = :aid;\n"
***************
*** 149,158 ****
/* -N case */
static char *simple_update = {
! "\\setrandom aid 1 100000\n"
! "\\setrandom bid 1 1\n"
! "\\setrandom tid 1 10\n"
! "\\setrandom delta 1 10000\n"
"BEGIN;\n"
"UPDATE accounts SET abalance = abalance + :delta WHERE aid = :aid;\n"
"SELECT abalance FROM accounts WHERE aid = :aid;\n"
--- 152,164 ----
/* -N case */
static char *simple_update = {
! "\\set nbranches :tps\n"
! "\\set ntellers 10 * :tps\n"
! "\\set naccounts 100000 * :tps\n"
! "\\setrandom aid 1 :naccounts\n"
! "\\setrandom bid 1 :nbranches\n"
! "\\setrandom tid 1 :ntellers\n"
! "\\setrandom delta -5000 5000\n"
"BEGIN;\n"
"UPDATE accounts SET abalance = abalance + :delta WHERE aid = :aid;\n"
"SELECT abalance FROM accounts WHERE aid = :aid;\n"
***************
*** 162,168 ****
/* -S case */
static char *select_only = {
! "\\setrandom aid 1 100000\n"
"SELECT abalance FROM accounts WHERE aid = :aid;\n"
};
--- 168,175 ----
/* -S case */
static char *select_only = {
! "\\set naccounts 100000 * :tps\n"
! "\\setrandom aid 1 :naccounts\n"
"SELECT abalance FROM accounts WHERE aid = :aid;\n"
};
***************
*** 570,581 ****
--- 577,590 ----
else
min = atoi(argv[2]);
+ #ifdef NOT_USED
if (min < 0)
{
fprintf(stderr, "%s: invalid minimum number %d\n", argv[0], min);
st->ecnt++;
return;
}
+ #endif
if (*argv[3] == ':')
{
***************
*** 597,602 ****
--- 606,614 ----
return;
}
+ #ifdef DEBUG
+ printf("min: %d max: %d random: %d\n", min, max, getrand(min, max));
+ #endif
snprintf(res, sizeof(res), "%d", getrand(min, max));
if (putVariable(st, argv[1], res) == false)
***************
*** 1477,1514 ****
/* process bultin SQL scripts */
switch (ttype)
{
- char buf[128];
-
case 0:
sql_files[0] = process_builtin(tpc_b);
- snprintf(buf, sizeof(buf), "%d", 100000 * tps);
- sql_files[0][0]->argv[3] = strdup(buf);
- snprintf(buf, sizeof(buf), "%d", 1 * tps);
- sql_files[0][1]->argv[3] = strdup(buf);
- snprintf(buf, sizeof(buf), "%d", 10 * tps);
- sql_files[0][2]->argv[3] = strdup(buf);
- snprintf(buf, sizeof(buf), "%d", 10000 * tps);
- sql_files[0][3]->argv[3] = strdup(buf);
num_files = 1;
break;
case 1:
sql_files[0] = process_builtin(select_only);
- snprintf(buf, sizeof(buf), "%d", 100000 * tps);
- sql_files[0][0]->argv[3] = strdup(buf);
num_files = 1;
break;
case 2:
sql_files[0] = process_builtin(simple_update);
- snprintf(buf, sizeof(buf), "%d", 100000 * tps);
- sql_files[0][0]->argv[3] = strdup(buf);
- snprintf(buf, sizeof(buf), "%d", 1 * tps);
- sql_files[0][1]->argv[3] = strdup(buf);
- snprintf(buf, sizeof(buf), "%d", 10 * tps);
- sql_files[0][2]->argv[3] = strdup(buf);
- snprintf(buf, sizeof(buf), "%d", 10000 * tps);
- sql_files[0][3]->argv[3] = strdup(buf);
num_files = 1;
break;
default:
break;
}
--- 1489,1509 ----
/* process bultin SQL scripts */
switch (ttype)
{
case 0:
sql_files[0] = process_builtin(tpc_b);
num_files = 1;
break;
+
case 1:
sql_files[0] = process_builtin(select_only);
num_files = 1;
break;
+
case 2:
sql_files[0] = process_builtin(simple_update);
num_files = 1;
break;
+
default:
break;
}