PostgreSQL & MySQL DB performance benchmarking.
Note: Tested on MySQL - v5.7 | PostgreSQL - v11.2
cp env.example .env
For e.g. if you have to get the stats of MySQL then comment out the PostgreSQL DB env variables and vice-versa.
npm install
npm run build or npm run build:watch Note: For more details please refer to the package.json file.
npm start
Sample output:
Total content size >>> 206
index | WRITE | READ | UPDATE
mysql | 3203.31 | 45.66 | 21.3
Total content size >>> 206
index | WRITE | READ | UPDATE
postgres | 2447.64 | 45.26 | 50.2
Note:
- If you want to calculate the average of 3 or whatever # of execution basis then execute the script those many times for the respective DB Dialect.
- The current stats are generated based on the sample json objected which is placed under
src/app/response
. This reponse object can be modified further. To get the more realstic stats add modified the json object and run the script. - This stats are derived only on the basis of JSON types data. This will tell you how much time it takes to do the WRITE, READ and UPDATE operation.
- The primary focus was on WRITE & READ. The
UPDATE
stats can be ignored. Becuase there are rare case when we do the bulk update else we mostly perform the udpate operation using primary key (or composite primary key).
Enhancement: Make the script dynamic to get the benchmarking stats.