pgpool-II 4.1.1 Documentation
Prev | Up | Chapter 1. Getting Started | Next

# 1.3. Testing Replication

Let's test the replication functionality using a benchmark tool `pgbench`, which comes with the standard PostgreSQL installation. Type following to create the benchmark tables.

        $ pgbench -i -p 11000 test

To see if the replication works correctly, directly connect to the primary and the standby server to see if they return identical results.

        $ psql -p 11002 test
        \dt
        List of relations
        Schema |       Name       | Type  |  Owner
        --------+------------------+-------+---------
        public | pgbench_accounts | table | t-ishii
        public | pgbench_branches | table | t-ishii
        public | pgbench_history  | table | t-ishii
        public | pgbench_tellers  | table | t-ishii
        (4 rows)
        \q
        $ psql -p 11003 test
        \dt
        List of relations
        Schema |       Name       | Type  |  Owner
        --------+------------------+-------+---------
        public | pgbench_accounts | table | t-ishii
        public | pgbench_branches | table | t-ishii
        public | pgbench_history  | table | t-ishii
        public | pgbench_tellers  | table | t-ishii
        (4 rows)

The primary server (port 11002) and the standby server (port 11003) return identical results. Next, let's run pgbench for a while and check to results.

        $ pgbench -p 11000 -T 10 test
        starting vacuum...end.
        transaction type: <builtin: TPC-B (sort of)>
        scaling factor: 1
        query mode: simple
        number of clients: 1
        number of threads: 1
        duration: 10 s
        number of transactions actually processed: 4276
        latency average = 2.339 ms
        tps = 427.492167 (including connections establishing)
        tps = 427.739078 (excluding connections establishing)

        $ psql -p 11002 -c "SELECT sum(abalance) FROM pgbench_accounts" test
        sum
        --------
        216117
        (1 row)

        $ psql -p 11003 -c "SELECT sum(abalance) FROM pgbench_accounts" test
        sum
        --------
        216117
        (1 row)

Again, the results are identical.

Prev | Home | Next
Your First Replication | Up | Testing Load Balance