From: Greg Smith Date: Fri, 8 Jan 2010 20:47:22 +0000 (-0500) Subject: Add initial 8.4 support X-Git-Tag: v0.6.0~12 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=13ab355ead8b9a60de22eee3de0f1f3589fddacb;p=pgbench-tools.git Add initial 8.4 support --- diff --git a/HISTORY b/HISTORY index f999c78..7dab01a 100644 --- a/HISTORY +++ b/HISTORY @@ -8,3 +8,5 @@ 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. diff --git a/README b/README index 8c59800..0b43616 100644 --- a/README +++ b/README @@ -1,61 +1,75 @@ 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 diff --git a/config b/config index 1be570b..55a9cc8 100755 --- a/config +++ b/config @@ -1,6 +1,14 @@ 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 diff --git a/runset b/runset index c244495..af3f601 100755 --- a/runset +++ b/runset @@ -17,7 +17,7 @@ for SCALE in $SCALES; do 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 diff --git a/tests-8.3/insert-size.sql b/tests-8.3/insert-size.sql new file mode 100644 index 0000000..b8ce9c7 --- /dev/null +++ b/tests-8.3/insert-size.sql @@ -0,0 +1 @@ +insert into data (filler) values (repeat(' ',:scale)); diff --git a/tests-8.3/insert.sql b/tests-8.3/insert.sql new file mode 100644 index 0000000..9451ba8 --- /dev/null +++ b/tests-8.3/insert.sql @@ -0,0 +1,8 @@ +\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); diff --git a/tests-8.3/nobranch.sql b/tests-8.3/nobranch.sql new file mode 100644 index 0000000..724ae85 --- /dev/null +++ b/tests-8.3/nobranch.sql @@ -0,0 +1,12 @@ +\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; diff --git a/tests-8.3/select.sql b/tests-8.3/select.sql new file mode 100644 index 0000000..caa5301 --- /dev/null +++ b/tests-8.3/select.sql @@ -0,0 +1,3 @@ +\set naccounts 100000 * :scale +\setrandom aid 1 :naccounts +SELECT abalance FROM accounts WHERE aid = :aid; diff --git a/tests-8.3/tpc-b.sql b/tests-8.3/tpc-b.sql new file mode 100644 index 0000000..4a0688d --- /dev/null +++ b/tests-8.3/tpc-b.sql @@ -0,0 +1,14 @@ +\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; diff --git a/tests-8.3/update.sql b/tests-8.3/update.sql new file mode 100644 index 0000000..470cf98 --- /dev/null +++ b/tests-8.3/update.sql @@ -0,0 +1,8 @@ +\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; diff --git a/tests/insert.sql b/tests/insert.sql index 9451ba8..d87be32 100644 --- a/tests/insert.sql +++ b/tests/insert.sql @@ -5,4 +5,4 @@ \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); diff --git a/tests/nobranch.sql b/tests/nobranch.sql index 724ae85..284422b 100644 --- a/tests/nobranch.sql +++ b/tests/nobranch.sql @@ -6,7 +6,7 @@ \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; diff --git a/tests/select.sql b/tests/select.sql index caa5301..55c41ab 100644 --- a/tests/select.sql +++ b/tests/select.sql @@ -1,3 +1,3 @@ \set naccounts 100000 * :scale \setrandom aid 1 :naccounts -SELECT abalance FROM accounts WHERE aid = :aid; +SELECT abalance FROM pgbench_accounts WHERE aid = :aid; diff --git a/tests/tpc-b.sql b/tests/tpc-b.sql index 4a0688d..2a72d8f 100644 --- a/tests/tpc-b.sql +++ b/tests/tpc-b.sql @@ -6,9 +6,9 @@ \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; diff --git a/tests/update.sql b/tests/update.sql index 470cf98..97cb3df 100644 --- a/tests/update.sql +++ b/tests/update.sql @@ -5,4 +5,4 @@ \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;