~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to contrib/pgbench/README.pgbench

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
pgbench README          2003/11/26 Tatsuo Ishii (t-ishii@sra.co.jp)
 
2
 
 
3
o What is pgbench?
 
4
 
 
5
  pgbench is a simple program to run a benchmark test sort of
 
6
  "TPC-B". pgbench is a client application of PostgreSQL and runs
 
7
  with PostgreSQL only. It performs lots of small and simple
 
8
  transactions including select/update/insert operations then
 
9
  calculates number of transactions successfully completed within a
 
10
  second (transactions per second, tps). Targeting data includes a
 
11
  table with at least 100k tuples.
 
12
 
 
13
  Example outputs from pgbench look like:
 
14
 
 
15
        number of clients: 4
 
16
        number of transactions per client: 100
 
17
        number of processed transactions: 400/400
 
18
        tps = 19.875015(including connections establishing)
 
19
        tps = 20.098827(excluding connections establishing)
 
20
 
 
21
  Similar program called "JDBCBench" already exists, but it requires
 
22
  Java that may not be available on every platform. Moreover some
 
23
  people concerned about the overhead of Java that might lead
 
24
  inaccurate results. So I decided to write in pure C, and named
 
25
  it "pgbench."
 
26
 
 
27
o features of pgbench
 
28
 
 
29
  - pgbench is written in C using libpq only. So it is very portable
 
30
    and easy to install.
 
31
 
 
32
  - pgbench can simulate concurrent connections using asynchronous
 
33
    capability of libpq. No threading is required.
 
34
 
 
35
o How to install pgbench
 
36
 
 
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".
 
47
 
 
48
o How to use pgbench?
 
49
 
 
50
  (1) Initialize database by:
 
51
 
 
52
        pgbench -i <dbname>
 
53
 
 
54
      where <dbname> is the name of database. pgbench uses four tables
 
55
      accounts, branches, history and tellers. These tables will be
 
56
      destroyed. Be very careful if you have tables having same
 
57
      names. Default test data contains:
 
58
 
 
59
        table           # of tuples
 
60
        -------------------------
 
61
        branches        1
 
62
        tellers         10
 
63
        accounts        100000
 
64
        history         0
 
65
 
 
66
        You can increase the number of tuples by using -s option. See
 
67
        below.
 
68
 
 
69
  (2) Run the benchmark test
 
70
 
 
71
        pgbench <dbname>
 
72
 
 
73
      The default configuration is:
 
74
 
 
75
        number of clients: 1
 
76
        number of transactions per client: 10
 
77
 
 
78
o options
 
79
 
 
80
  pgbench has number of options.
 
81
 
 
82
        -h hostname
 
83
                hostname where the backend is running. If this option
 
84
                is omitted, pgbench will connect to the localhost via
 
85
                Unix domain socket.
 
86
 
 
87
        -p port
 
88
                the port number that the backend is accepting. default is
 
89
                libpq's default, usually 5432.
 
90
 
 
91
        -c number_of_clients
 
92
                Number of clients simulated. default is 1.
 
93
 
 
94
        -t number_of_transactions
 
95
                Number of transactions each client runs. default is 10.
 
96
 
 
97
        -s scaling_factor
 
98
                this should be used with -i (initialize) option.
 
99
                number of tuples generated will be multiple of the
 
100
                scaling factor. For example, -s 100 will imply 10M
 
101
                (10,000,000) tuples in the accounts table.
 
102
                default is 1.  NOTE: scaling factor should be at least
 
103
                as large as the largest number of clients you intend
 
104
                to test; else you'll mostly be measuring update contention.
 
105
 
 
106
        -U login
 
107
                Specify db user's login name if it is different from
 
108
                the Unix login name.
 
109
 
 
110
        -P password
 
111
                Specify the db password. CAUTION: using this option
 
112
                might be a security hole since ps command will
 
113
                show the password. Use this for TESTING PURPOSE ONLY.
 
114
 
 
115
        -n
 
116
                No vacuuming and cleaning the history table prior to the
 
117
                test is performed.
 
118
 
 
119
        -v
 
120
                Do vacuuming before testing. This will take some time.
 
121
                With neither -n nor -v, pgbench will vacuum tellers and
 
122
                branches tables only.
 
123
 
 
124
        -S
 
125
                Perform select only transactions instead of TPC-B.
 
126
 
 
127
        -C
 
128
                Establish connection for each transaction, rather than
 
129
                doing it just once at beginning of pgbench in the normal
 
130
                mode. This is useful to measure the connection overhead.
 
131
        
 
132
        -l
 
133
                Write the time taken by each transaction to a logfile,
 
134
                with the name "pgbench_log.xxx", where xxx is the PID
 
135
                of the pgbench process. The format of the log is:
 
136
 
 
137
                        client_id transaction_no time
 
138
 
 
139
                where time is measured in microseconds.
 
140
 
 
141
        -d
 
142
                debug option.
 
143
 
 
144
 
 
145
o What is the "transaction" actually performed in pgbench?
 
146
 
 
147
  (1) begin;
 
148
 
 
149
  (2) update accounts set abalance = abalance + :delta where aid = :aid;
 
150
 
 
151
  (3) select abalance from accounts where aid = :aid;
 
152
 
 
153
  (4) update tellers set tbalance = tbalance + :delta where tid = :tid;
 
154
 
 
155
  (5) update branches set bbalance = bbalance + :delta where bid = :bid;
 
156
 
 
157
  (6) insert into history(tid,bid,aid,delta) values(:tid,:bid,:aid,:delta);
 
158
 
 
159
  (7) end;
 
160
 
 
161
o License?
 
162
 
 
163
Basically it is same as BSD license. See pgbench.c for more details.
 
164
 
 
165
o History
 
166
 
 
167
2003/11/26
 
168
        * create indexes after data insertion to reduce time.
 
169
          patch from Yutaka Tanida.
 
170
 
 
171
2003/06/10
 
172
        * fix uninitialized memory bug
 
173
        * add support for PGHOST, PGPORT, PGUSER environment variables
 
174
 
 
175
2002/07/20
 
176
        * patch contributed by Neil Conway.
 
177
        * code/document clean up and add -l option.
 
178
 
 
179
2002/02/24
 
180
        * do not CHECKPOINT anymore while initializing benchmark
 
181
        * database. Add -N option.
 
182
 
 
183
2001/10/24
 
184
        * "time"->"mtime"
 
185
 
 
186
2001/09/09
 
187
        * Add -U, -P, -C options
 
188
 
 
189
2000/1/15 pgbench-1.2 contributed to PostgreSQL
 
190
        * Add -v option
 
191
 
 
192
1999/09/29 pgbench-1.1 released
 
193
        * Apply cygwin patches contributed by Yutaka Tanida
 
194
        * More robust when backends die
 
195
        * Add -S option (select only)
 
196
 
 
197
1999/09/04 pgbench-1.0 released