Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9b19abd

Browse files
committed
Add -f option which enables to read SQL commands from a file.
Patches Contributed by Tomoaki Sato.
1 parent8928d4d commit9b19abd

File tree

3 files changed

+666
-92
lines changed

3 files changed

+666
-92
lines changed

‎contrib/pgbench/README.pgbench

Lines changed: 58 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pgbench README2003/11/26 Tatsuo Ishii (t-ishii@sra.co.jp)
1+
pgbench README2005/09/29 Tatsuo Ishii
22

33
o What is pgbench?
44

@@ -34,16 +34,8 @@ o features of pgbench
3434

3535
o How to install pgbench
3636

37-
(1) Configure and build the standard Postgres distribution.
38-
39-
You can get away with just running configure at the top level
40-
and doing "make all" in src/interfaces/libpq.
41-
42-
(2) Run make in this directory.
43-
44-
You will see an executable file "pgbench". You can run it here,
45-
or install it with the standard Postgres programs by doing
46-
"make install".
37+
$make
38+
$make install
4739

4840
o How to use pgbench?
4941

@@ -124,6 +116,15 @@ o options
124116
-S
125117
Perform select only transactions instead of TPC-B.
126118

119+
-NDo not update "branches" and "tellers". This will
120+
avoid heavy update contention on branches and tellers,
121+
while it will not make pgbench supporting TPC-B like
122+
transactions.
123+
124+
-f filename
125+
Read transaction script from file. Detailed
126+
explanation will appear later.
127+
127128
-C
128129
Establish connection for each transaction, rather than
129130
doing it just once at beginning of pgbench in the normal
@@ -158,12 +159,58 @@ o What is the "transaction" actually performed in pgbench?
158159

159160
(7) end;
160161

162+
o -f option
163+
164+
This supports for reading transaction script from a specified
165+
file. This file should include SQL commands in each line. SQL
166+
command consists of multiple lines are not supported. Empty lines
167+
and lines begging with "--" will be ignored.
168+
169+
SQL commands can include "meta command" which begins with "\" (back
170+
slash). A meta command takes some arguments separted by white
171+
spaces. Currently following meta command is supported:
172+
173+
\setrandom name min max
174+
175+
assign random integer to name between min and max
176+
177+
example:
178+
179+
\setrandom aid 1 100000
180+
181+
variables can be reffered to in SQL comands by adding ":" in front
182+
of the varible name.
183+
184+
example:
185+
186+
SELECT abalance FROM accounts WHERE aid = :aid
187+
188+
For example, TPC-B like benchmark can be defined as follows(scaling
189+
factor = 1):
190+
191+
\setrandom aid 1 100000
192+
\setrandom bid 1 1
193+
\setrandom tid 1 10
194+
\setrandom delta 1 10000
195+
BEGIN
196+
UPDATE accounts SET abalance = abalance + :delta WHERE aid = :aid
197+
SELECT abalance FROM accounts WHERE aid = :aid
198+
UPDATE tellers SET tbalance = tbalance + :delta WHERE tid = :tid
199+
UPDATE branches SET bbalance = bbalance + :delta WHERE bid = :bid
200+
INSERT INTO history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, 'now')
201+
END
202+
161203
o License?
162204

163205
Basically it is same as BSD license. See pgbench.c for more details.
164206

165207
o History
166208

209+
2005/09/29
210+
* add -f option. contributed by Tomoaki Sato.
211+
212+
[updation records were missing]
213+
167214
2003/11/26
168215
* create indexes after data insertion to reduce time.
169216
patch from Yutaka Tanida.

‎contrib/pgbench/README.pgbench_jis

Lines changed: 65 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
pgbench README2003/11/26 Tatsuo Ishii (t-ishii@sra.co.jp)
1+
pgbench README2005/09/29 Tatsuo Ishii
22

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

5-
pgbench $B$O(B TPC-B$B$K;w$?%Y%s%A%^!<%/%F%9%H$r9T$J$&%W%m%0%i%`$G$9!%:#$N$H(B
6-
$B$3$m(BPostgreSQL $B@lMQ$G$9!%(B
5+
pgbench $B$O%Y%s%A%^!<%/%F%9%H$r9T$J$&%W%m%0%i%`$G$9!%:#$N$H$3$m(B
6+
PostgreSQL $B@lMQ$G$9!%(B
77

88
pgbench $B$O(B select/update/insert $B$r4^$`%H%i%s%6%/%7%g%s$r<B9T$7!$A4BN$N(B
99
$B<B9T;~4V$H<B:]$K40N;$7$?%H%i%s%6%/%7%g%s$N?t$+$i(B 1 $BIC4V$K<B9T$G$-$?%H(B
@@ -31,16 +31,12 @@ o pgbench $B$O(B libpq $B$NHsF14|=hM}5!G=$r;H$C$F%^%k%A%f!<%64D6-$r%7%_%e%l!<
3131

3232
$B"#(Bpgbench $B$N%$%s%9%H!<%k(B
3333

34-
(1) PostgreSQL$B$r(Bconfigure$B!$%3%s%Q%$%k$7$^$9!%(Bpgbench$B$N%$%s%9%H!<%k$@$1(B
35-
$B$,L\E*$G$"$l$P!$(BPostgreSQL$B$N$9$Y$F$r%3%s%Q%$%k$9$kI,MW$O$"$j$^$;$s!%(B
36-
PostgreSQL$B%=!<%9$N%H%C%W%G%#%l%/%H%j$G(Bconfigure$B$r$7$?8e!$(B
37-
src/interface/libpq $B$G(B "make all" $B$r<B9T$9$l$P=`Hw40N;$G$9!%(B
34+
PostgreSQL$B$r%3%s%Q%$%k!$%$%s%9%H!<%k$7$?8e(B
3835

39-
(2) $B$3$N%G%#%l%/%H%j$G(B make $B$r<B9T$7$^$9!%$=$&$9$k$H!$(B"pgbench" $B$H$$$&(B
40-
$B<B9T%W%m%0%i%`$,$G$-$^$9!%$=$N$^$^<B9T$7$F$b9=$$$^$;$s$7!$(B"make
41-
install" $B$r<B9T$7$F(B PostgreSQL $B$NI8=`<B9T%W%m%0%i%`%G%#%l%/%H%j(B
42-
($B%G%U%)%k%H$G$O(B /usr/local/pgsql/bin) $B$K%$%s%9%H!<%k$9$k$3$H$b$G$-(B
43-
$B$^$9!%(B
36+
$ make
37+
$ make install
38+
39+
$B$H$7$^$9!%(B
4440

4541
$B"#(Bpgbench $B$N;H$$J}(B
4642

@@ -104,6 +100,12 @@ pgbench $B$K$O$$$m$$$m$J%*%W%7%g%s$,$"$j$^$9!%(B
104100
$B$OE,9g$7$J$/$J$j$^$9$,!$$h$j8=<BE*$JIi2Y$r%F%9%H$9$k$3(B
105101
$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a%?%3%^%s%I(B
189+
$B$r5-=R$G$-$^$9!%%a%?%3%^%s%I$O(B pgbench $B<+?H$K$h$C$F<B9T$5$l$^$9!%%a%?(B
190+
$B%3%^%s%I$N7A<0$O%P%C%/%9%i%C%7%e!$$=$ND>8e$K%3%^%s%I$NF0;l!$$=$N<!$K0z(B
191+
$B?t$,B3$-$^$9!%F0;l%3%^%s%I$H0z?t!$$^$?$=$l$>$l$N0z?t$O6uGrJ8;z$K$h$C$F(B
192+
$B6h@Z$i$l$^$9!%(B
193+
194+
$B8=:_$N$H$3$m!$0J2<$N%a%?%3%^%s%I$,Dj5A$5$l$F$$$^$9!%(B
195+
196+
\setrandom name min max
197+
$B:G>.CM(B min $B$H:GBgCM(B max $B$N4V$NCM$r<h$kMp?t$r!$(Bname $BJQ?t$K@_Dj(B
198+
$B$7$^$9!%(B
199+
200+
$BJQ?t$KMp?t$r@_Dj$9$k$K$O!$(B\setrandom $B%a%?%3%^%s%I$r;HMQ$7$F0J2<$N$h$&(B
201+
$B$K5-=R$7$^$9!%(B
202+
203+
\setrandom aid 1 100000
204+
205+
$B$3$l$O!$JQ?t(B aid $B$K(B 1 $B$+$i(B 100000 $B$N4V$NMp?t$r@_Dj$7$^$9!%$^$?!$JQ?t$N(B
206+
$BCM$r(B SQL $B%3%^%s%I$KKd$a9~$`$K$O!$0J2<$N$h$&$K$=$NL>A0$NA0$K%3%m%s$rIU(B
207+
$B$1$^$9!%(B
208+
209+
SELECT abalance FROM accounts WHERE aid = :aid
210+
211+
$BNc$($P!$(BTCP-B $B$KN`;w$7$?%Y%s%A%^!<%/$r7WB,$9$k$K$O!$0J2<$N$h$&$K%H%i%s(B
212+
$B%6%/%7%g%s$NFbMF$r%U%!%$%k$K5-=R$7!$(B-f $B%*%W%7%g%s$K$h$C$F$=$N%U%!%$%k(B
213+
$B$r;XDj$7$F(B pgbench $B$r<B9T$7$^$9!%(B
214+
215+
\setrandom aid 1 100000
216+
\setrandom bid 1 1
217+
\setrandom tid 1 10
218+
\setrandom delta 1 10000
219+
BEGIN
220+
UPDATE accounts SET abalance = abalance + :delta WHERE aid = :aid
221+
SELECT abalance FROM accounts WHERE aid = :aid
222+
UPDATE tellers SET tbalance = tbalance + :delta WHERE tid = :tid
223+
UPDATE branches SET bbalance = bbalance + :delta WHERE bid = :bid
224+
INSERT INTO history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, 'now')
225+
END
226+
179227
$B"#:n<T$H%i%$%;%s%9>r7o(B
180228

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

185233
$B"#2~DjMzNr(B
186234

235+
2005/09/29
236+
* $B:4F#$5$s$N%Q%C%A$rE,MQ!%(B-f $B%*%W%7%g%s$NDI2C!%(B
237+
238+
[$B$3$N4V$$$m$$$mJQ99$,$"$C$?$h$&$@$,(BREADME$B$O%a%$%s%F%J%s%9$5$l$F$$$J$$(B]
239+
187240
2003/11/26
188241
* $BC+ED$5$s$N%Q%C%A$rE,MQ!%(Bpgbench -i$B$N:]$K!$8e$+$i<g%-!<$r:n@.(B
189242
$B$9$k$h$&$K$7$?!%$3$l$K$h$C$F=i4|2=$N<B9T;~4V$,BgI}$KC;=L$G$-(B

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp