Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 43f77c0

Browse files
committed
Patches from Yutaka Tanida. Create primary key indexes after data
insertion to reduce initialization time.
1 parent e7a45c7 commit 43f77c0

File tree

3 files changed

+33
-7
lines changed

3 files changed

+33
-7
lines changed

contrib/pgbench/README.pgbench

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pgbench README 2002/07/20 Tatsuo Ishii (t-ishii@sra.co.jp)
1+
pgbench README 2003/11/26 Tatsuo Ishii (t-ishii@sra.co.jp)
22

33
o What is pgbench?
44

@@ -164,6 +164,10 @@ Basically it is same as BSD license. See pgbench.c for more details.
164164

165165
o History
166166

167+
2003/11/26
168+
* create indexes after data insertion to reduce time.
169+
patch from Yutaka Tanida.
170+
167171
2003/06/10
168172
* fix uninitialized memory bug
169173
* add support for PGHOST, PGPORT, PGUSER environment variables

contrib/pgbench/README.pgbench_jis

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pgbench README 2002/07/20 Tatsuo Ishii (t-ishii@sra.co.jp)
1+
pgbench README 2003/11/26 Tatsuo Ishii (t-ishii@sra.co.jp)
22

33
$B"#(Bpgbench $B$H$O!)(B
44

@@ -184,6 +184,11 @@ pgbench $B$O@P0f(B $BC#IW$K$h$C$F=q$+$l$^$7$?!%%i%$%;%s%9>r7o$O(B pgbench.c
184184

185185
$B"#2~DjMzNr(B
186186

187+
2003/11/26
188+
* $BC+ED$5$s$N%Q%C%A$rE,MQ!%(Bpgbench -i$B$N:]$K!$8e$+$i<g%-!<$r:n@.(B
189+
$B$9$k$h$&$K$7$?!%$3$l$K$h$C$F=i4|2=$N<B9T;~4V$,BgI}$KC;=L$G$-(B
190+
$B$k(B($B$O$:(B)$B!%(B
191+
187192
2003/06/10
188193
* $B%a%b%j$,=i4|2=$5$l$F$$$J$$%P%0$r=$@5(B
189194
* $B4D6-JQ?t(BPGHOST, PGPORT, PGUSER$B$rG'<1$9$k$h$&$K$7$?!%(B

contrib/pgbench/pgbench.c

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*
2-
* $Header: /cvsroot/pgsql/contrib/pgbench/pgbench.c,v 1.27 2003/09/27 19:15:34 wieck Exp $
2+
* $Header: /cvsroot/pgsql/contrib/pgbench/pgbench.c,v 1.28 2003/11/26 06:53:18 ishii Exp $
33
*
44
* pgbench: a simple TPC-B like benchmark program for PostgreSQL
55
* written by Tatsuo Ishii
66
*
7-
* Copyright (c) 2000-2002 Tatsuo Ishii
7+
* Copyright (c) 2000-2003 Tatsuo Ishii
88
*
99
* Permission to use, copy, modify, and distribute this software and
1010
* its documentation for any purpose and without fee is hereby
@@ -482,13 +482,19 @@ init(void)
482482
PGresult *res;
483483
static char *DDLs[] = {
484484
"drop table branches",
485-
"create table branches(bid int, primary key(bid),bbalance int,filler char(88))",
485+
"create table branches(bid int not null,bbalance int,filler char(88))",
486486
"drop table tellers",
487-
"create table tellers(tid int, primary key(tid),bid int,tbalance int,filler char(84))",
487+
"create table tellers(tid int not null,bid int,tbalance int,filler char(84))",
488488
"drop table accounts",
489-
"create table accounts(aid int,primary key(aid),bid int,abalance int,filler char(84))",
489+
"create table accounts(aid int not null,bid int,abalance int,filler char(84))",
490490
"drop table history",
491491
"create table history(tid int,bid int,aid int,delta int,mtime timestamp,filler char(22))"};
492+
static char *DDLAFTERs[] = {
493+
"alter table branches add primary key (bid)",
494+
"alter table tellers add primary key (tid)",
495+
"alter table accounts add primary key (aid)"};
496+
497+
492498
char sql[256];
493499

494500
int i;
@@ -608,6 +614,17 @@ init(void)
608614
#endif /* NOT_USED */
609615
}
610616
}
617+
fprintf(stderr, "set primary key...\n");
618+
for (i = 0; i < (sizeof(DDLAFTERs) / sizeof(char *)); i++)
619+
{
620+
res = PQexec(con, DDLAFTERs[i]);
621+
if (strncmp(DDLs[i], "drop", 4) && PQresultStatus(res) != PGRES_COMMAND_OK)
622+
{
623+
fprintf(stderr, "%s", PQerrorMessage(con));
624+
exit(1);
625+
}
626+
PQclear(res);
627+
}
611628

612629
/* vacuum */
613630
fprintf(stderr, "vacuum...");

0 commit comments

Comments
 (0)