February 2020
Intermediate to advanced
734 pages
38h 13m
English
This recipe uses an existing database for concrete numbers. If you do not have one of these, create it with pgbench using the following commands as the postgres user:
createdb pgbench
pgbench -i -s 200 pgbench
The -i flag initializes a new series of benchmark tables and the -s flag specifies the scale of the data. We started with a scale of 200, so our largest table has 20 million rows and is about 3 GB in size. Feel free to use a higher scale for demonstrative purposes.
We will also be using the pg_stat_statements extension that we discussed in the Checking the pg_stat_statements view recipe from Chapter 5, Troubleshooting. Make sure that it's installed in every database with the following SQL statement:
CREATE EXTENSION pg_stat_statements; ...
Read now
Unlock full access