Scale detection
The number of branches is referred to as the database scale, with each branch adding another 10 tellers and 100,000 accounts to the database. This value is input when you initialize the database pgbench
is told to create tables into. Here's an example that creates a database for pgbench
and then populates it with the pgbench
tables:
$ createdb pgbench $ pgbench -i -s 10 pgbench
This will initialize (-i
) the pgbench tables using a scale of 10 (-s 10
) into the database named pgbench
. You don't have to use that name, but it's a common convention.
When pgbench
runs in a regular mode (not initialization), it first checks if you have manually told it the database scale using -s
; if so, it uses that value. If not, and you're running one of the default tests, it will try to detect the scale using the following query:
SELECT count(*) FROM pgbench_branches;
If you run a custom query, the scale will never be detected for you—it will always be assumed...