what is the best way to capture the usage of CPU and memory while running pgbench? The only way I can think of is to read the info from top header.

what I do now

  1. I run top command by print it out in a log file.
  2. Then grep the cpu and memory in another txt file
  3. Later I download the txt file and import it in excel file to get the average value of Cpu usage and Memory usage
  4. The result of pgbench will be put together in the excel file

Is there any tips or standard of procedure to implement the TPC-B as well as monitor the resources.


I show some tools I know.

pg_activity is a simple monitoring tool like top.

pg_statsinfo and pg_stats_reporter are high quality utilities that monitor statistics and the activity of PostgreSQL as well as Operating system.

There are some general purpose monitoring tools such as Cacti and Munin. Those support postgres by providing modules and they can easily be used.

BTW, I know a great book: The Art of Computer Systems Performance Analysis. This gives you some hints for benchmarking.

  • how do you run this? concurrent monitor with pgbench? – Muhaimin Feb 23 '16 at 10:58
  • pgbench is just a benchmark tool, it's not a practical system. If you want to know the result of pgbench, you can frequently run it and can run one of the monitoring tools together. There is no need to run those monitoring tools at same time (concurrently). – shx Feb 23 '16 at 11:08
  • thanks @shx. I think I don't want to install extra tools to measure it – Muhaimin Feb 24 '16 at 2:00

Greg Smith has pgbench-tools which does multiple runs of pgbench, with concurrent runs of vmstat and iostat during the pgbench runs. It also lets you graph results with gnuplot. It sounds like it would fit your needs well.

  • thanks @Kassandry. I don't think I need extra tools. Perhaps you can elaborate steps to be taken without installing extra tools. Thanks again – Muhaimin Feb 24 '16 at 1:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.