Bugs reported by Robert Treat and Jignesh Shah fixed,
improving compatiblity with Solaris.
+0.5 2010-01-08 Add PostgreSQL 8.4 and later support. README is now valid
+ reST.
pgbench-tools Setup
===================
--Create databases for your test and for the results
---Both databases can be the same, but there may be more shared_buffers
- cache churn in that case. Some amount of cache disruption
- is unavoidable unless the result database is remote, because
- of the OS cache.
+* Create databases for your test and for the results
--Initialize the results database by executing
+ * Both databases can be the same, but there may be more shared_buffers
+ cache churn in that case. Some amount of cache disruption
+ is unavoidable unless the result database is remote, because
+ of the OS cache.
- psql -f init/resultdb.sql
+* Initialize the results database by executing::
+
+ psql -f init/resultdb.sql
+
+ This will create a default test set entry with a blank description.
+ You may want to rename this.
Running tests
=============
--Edit the config file to run the tests you want
+* Edit the config file to run the tests you want
--Execute
+* Execute::
- ./runset
+ ./runset
- In order to execute all the tests
+ In order to execute all the tests
Results
=======
--You can check results even as the test is running with:
+* You can check results even as the test is running with::
- psql [resultdb] -f report.sql
+ psql [resultdb] -f report.sql
--Other useful reports you can run include:
+* Other useful reports you can run include:
* summary.sql
* bufreport.sql
* bufsummary.sql
--Once the tests are done, the results/ directory will include
- a HTML subdirectory for each test giving its results,
- in addition to the summary information in the results database.
+* Once the tests are done, the results/ directory will include
+ a HTML subdirectory for each test giving its results,
+ in addition to the summary information in the results database.
--The results directory will also include its own index file that
- shows summary information and plots for all the tests.
+* The results directory will also include its own index file that
+ shows summary information and plots for all the tests.
--If you manually adjust the test result database, you can
- manually regenerate the summary graphs by running:
+* If you manually adjust the test result database, you can
+ manually regenerate the summary graphs by running::
- ./webreport
+ ./webreport
-Known issues
-============
+Version Compatibility
+=====================
--If running tests against non-pgbench tables, the database scale
- will not be detected correctly yet
+The default configuration now aims to support the pgbench that ships with
+PostgreSQL 8.4 and later versions, which uses names such as "pgbench_accounts"
+for its tables. There are commented out settings on the config file that
+show what changes need to be made in order to make the program compatible
+with PostgreSQL 8.3, where the names were like "accounts" instead.
--Recent PostgreSQL 8.4 development releases have changed the
- names of all the pgbench tables such that this program doesn't
- work against recent code snapshots yet
+Support for PostgreSQL versions before 8.3 is not possible, because a
+change was made to the pgbench client in that version that is needed
+by the program to work properly. It is possible to use the PostgreSQL 8.3
+pgbench client against a newer database server, or to copy the pgbench.c
+program from 8.3 into a 8.2 source code build and use it instead.
+
+Known issues
+============
--On Solaris, where the benchwarmer script calls tail it may need
- to use /usr/xpg4/bin/tail instead
+* If running tests against non-pgbench tables, the database scale
+ will not be detected correctly yet
+* On Solaris, where the benchwarmer script calls tail it may need
+ to use /usr/xpg4/bin/tail instead
BASEDIR=`pwd`
PGBENCHBIN=`which pgbench`
+# These values are for pgbench 8.4 and later
+TABLEPREFIX="pgbench_"
+TESTDIR="tests"
+
+# Use these values for pgbench 8.3
+#TABLEPREFIX=""
+#TESTDIR="tests-8.3"
+
TESTHOST=localhost
TESTUSER=postgres
TESTDB=pgbench
if [ "$SKIPINIT" -ne "1" ]; then
echo Removing old pgbench tables
TESTPSQL="psql -h $TESTHOST -U $TESTUSER -p $TESTPORT -d $TESTDB"
- $TESTPSQL -c "drop table accounts; drop table branches; drop table tellers; drop table history;"
+ $TESTPSQL -c "drop table ${TABLEPREFIX}accounts; drop table ${TABLEPREFIX}branches; drop table ${TABLEPREFIX}tellers; drop table ${TABLEPREFIX}history;"
$TESTPSQL -c "vacuum full"
echo Creating new pgbench tables
--- /dev/null
+insert into data (filler) values (repeat(' ',:scale));
--- /dev/null
+\set nbranches :scale
+\set ntellers 10 * :scale
+\set naccounts 100000 * :scale
+\setrandom aid 1 :naccounts
+\setrandom bid 1 :nbranches
+\setrandom tid 1 :ntellers
+\setrandom delta -5000 5000
+INSERT INTO history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
--- /dev/null
+\set nbranches :scale
+\set ntellers 10 * :scale
+\set naccounts 100000 * :scale
+\setrandom aid 1 :naccounts
+\setrandom bid 1 :nbranches
+\setrandom tid 1 :ntellers
+\setrandom delta -5000 5000
+BEGIN;
+UPDATE accounts SET abalance = abalance + :delta WHERE aid = :aid;
+SELECT abalance FROM accounts WHERE aid = :aid;
+INSERT INTO history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
+END;
--- /dev/null
+\set naccounts 100000 * :scale
+\setrandom aid 1 :naccounts
+SELECT abalance FROM accounts WHERE aid = :aid;
--- /dev/null
+\set nbranches :scale
+\set ntellers 10 * :scale
+\set naccounts 100000 * :scale
+\setrandom aid 1 :naccounts
+\setrandom bid 1 :nbranches
+\setrandom tid 1 :ntellers
+\setrandom delta -5000 5000
+BEGIN;
+UPDATE accounts SET abalance = abalance + :delta WHERE aid = :aid;
+SELECT abalance FROM accounts WHERE aid = :aid;
+UPDATE tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
+UPDATE branches SET bbalance = bbalance + :delta WHERE bid = :bid;
+INSERT INTO history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
+END;
--- /dev/null
+\set nbranches :scale
+\set ntellers 10 * :scale
+\set naccounts 100000 * :scale
+\setrandom aid 1 :naccounts
+\setrandom bid 1 :nbranches
+\setrandom tid 1 :ntellers
+\setrandom delta -5000 5000
+UPDATE accounts SET abalance = abalance + :delta WHERE aid = :aid;
\setrandom bid 1 :nbranches
\setrandom tid 1 :ntellers
\setrandom delta -5000 5000
-INSERT INTO history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
+INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
\setrandom tid 1 :ntellers
\setrandom delta -5000 5000
BEGIN;
-UPDATE accounts SET abalance = abalance + :delta WHERE aid = :aid;
-SELECT abalance FROM accounts WHERE aid = :aid;
-INSERT INTO history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
+UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
+SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
+INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
END;
\set naccounts 100000 * :scale
\setrandom aid 1 :naccounts
-SELECT abalance FROM accounts WHERE aid = :aid;
+SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
\setrandom tid 1 :ntellers
\setrandom delta -5000 5000
BEGIN;
-UPDATE accounts SET abalance = abalance + :delta WHERE aid = :aid;
-SELECT abalance FROM accounts WHERE aid = :aid;
-UPDATE tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
-UPDATE branches SET bbalance = bbalance + :delta WHERE bid = :bid;
-INSERT INTO history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
+UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
+SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
+UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
+UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
+INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
END;
\setrandom bid 1 :nbranches
\setrandom tid 1 :ntellers
\setrandom delta -5000 5000
-UPDATE accounts SET abalance = abalance + :delta WHERE aid = :aid;
+UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;