Member-only story
Benchmark PostgreSQL: cross between native versus Docker

Few months ago, I did two benchmarks. The first one tested three database engines and the second one only PostgreSQL.
You can find those benchmarks in those two links below. Both articles are written by Petr Jahoda.
Because there were some ideas about this benchmark, I decided to make another one. This time, we will be testing PostgreSQL 13 only, on linux machine, using AWS, and the test will be using the same code as before.
We will have four tests:
- database running natively, program running natively
- database running in Docker, program running natively
- database running in Docker, program running in Docker
- database running natively, program running in Docker
I am expecting no significant differences, but numbers will tell us more.
Preparing the linux machine in AWS
For this specific test, t2.micro was selected: 1xCPU and 1GB RAM, eligible for free tier. After connecting into the running machine, we can check the information to see, what is running.

First step, after your cloud machine is running, is to install Docker:
- update the machine running
sudo yum update -y
- install Docker using
sudo yum install docker -y
- enable Docker using
sudo systemctl enable docker
- start Docker using
sudo systemctl start docker
- add your user to docker group using…