https://github.com/peterdee/postgresql-test
PostgreSQL performance testing with Node & Sequelize
https://github.com/peterdee/postgresql-test
nodejs postgresql sequelize sql
Last synced: about 1 month ago
JSON representation
PostgreSQL performance testing with Node & Sequelize
- Host: GitHub
- URL: https://github.com/peterdee/postgresql-test
- Owner: peterdee
- Created: 2020-07-03T16:39:15.000Z (almost 6 years ago)
- Default Branch: develop
- Last Pushed: 2022-04-12T11:15:17.000Z (about 4 years ago)
- Last Synced: 2025-01-21T10:11:15.897Z (over 1 year ago)
- Topics: nodejs, postgresql, sequelize, sql
- Language: JavaScript
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## PostgreSQL performance testing with Node & Sequelize
Testing some PostgreSQL capabilities:
- comparing raw SQL query speeds with Sequelize
- estimating query speeds for the big databases (millions of table records)
### Deploy
```shell script
git clone https://github.com/peterdee/postgresql-test
cd ./postgresql-test
nvm use 14
npm i
```
### Environment
The `.env` file is required, see the [.env.example](.env.example) file for more information about the required environemnt variables
### Run
```shell script
npm start
```
### Results
Testing locally on a MacBook Pro 15-inch (2018) with 16GB RAM
```text
database ready
count users: 74 ms, 2082174 users
count users [RAW]: 69 ms, 2082174 users
load single record without any condition: 3 ms
load single record without any condition [RAW]: 1 ms
load multiple records without any condition: 186 ms
load multiple records without any condition [RAW]: 182 ms
load single record with conditions: 4 ms
load single record with conditions [RAW]: 0 ms
load multiple records with conditions: 230 ms, found 500 results
load multiple records with conditions [RAW]: 231 ms, found 500 results
load single record with JOIN without any condition [RAW]: 717 ms
load single record with JOIN with conditions [RAW]: 437 ms
load multiple records with JOIN without any condition [RAW]: 1726 ms
load multiple records with JOIN with conditions [RAW]: 440 ms
load multiple records with JOIN without any condition (with CTE) [RAW]: 373 ms
load multiple records with JOIN with conditions (with CTE) [RAW]: 221 ms
```
Using `CTE` provides a significant performance boost