@@ -6,10 +6,12 @@ This is a set of benchmarks focusing on the performance of Postgres client libra
66
77Currently benchmarked libraries are
88
9- - [ postgres ] ( https://github.com/porsager/postgres )
9+ - [ Postgres.js ] ( https://github.com/porsager/postgres )
1010- [ pg-promise] ( https://github.com/vitaly-t/pg-promise )
1111- [ pg] ( https://github.com/brianc/node-postgres )
1212- [ pg-native] ( https://github.com/brianc/node-pg-native )
13+ - [ slonik] ( https://github.com/gajus/slonik )
14+
1315
1416## Results
1517
@@ -18,12 +20,12 @@ The time is the average of 5 rounds, running the queries 10,000 times after some
1820
1921client | select | select_arg | select_args | select_where
2022:--------- | -------------: | -------------: | -------------: | -------------:
21- postgres | 0.100s (4.8x) | 0.105s (7.4x) | 0.231s (4.3x) | 0.233s (5.1x)
22- pg-promise | 0.360s (1.3x) | 0.427s (1.8x) | 0.662s (1.5x) | 0.801s (1.5x)
23- pg-promise-native | 0.371s (1.3x) | 0.435s (1.8x) | 0.673s (1.5x) | 0.807s (1.5x)
24- pg | 0.322s (1.5x) | 0.611s (1.3x) | 0.815s (1.2x) | 1.057s (1.1x)
25- pg-native | 0.479s (1.0x) | 0.551s (1.4x) | 0.885s (1.1x) | 1.183s (1.0x)
26- slonik | 0.453s (1.1x) | 0.773s (1.0x) | 0.992s (1.0x) | 1.108s (1.1x)
23+ [ Postgres.js ] ( https://github.com/porsager/ postgres) | 0.100s (4.8x) | 0.105s (7.4x) | 0.231s (4.3x) | 0.233s (5.1x)
24+ [ pg-promise] ( https://github.com/vitaly-t/pg-promise ) | 0.360s (1.3x) | 0.427s (1.8x) | 0.662s (1.5x) | 0.801s (1.5x)
25+ [ pg-promise-native] ( https://github.com/vitaly-t/pg-promise ) | 0.371s (1.3x) | 0.435s (1.8x) | 0.673s (1.5x) | 0.807s (1.5x)
26+ [ pg ] ( https://github.com/brianc/node-postgres ) | 0.322s (1.5x) | 0.611s (1.3x) | 0.815s (1.2x) | 1.057s (1.1x)
27+ [ pg-native] ( https://github.com/brianc/node-pg-native ) | 0.479s (1.0x) | 0.551s (1.4x) | 0.885s (1.1x) | 1.183s (1.0x)
28+ [ slonik] ( https://github.com/gajus/slonik ) | 0.453s (1.1x) | 0.773s (1.0x) | 0.992s (1.0x) | 1.108s (1.1x)
2729
2830![ results chart] ( results.png )
2931> lower is better
@@ -72,3 +74,12 @@ select * from pg_catalog.pg_type where typname = $1
7274-- $1 = 'bool'
7375```
7476
77+
78+ #### Running the benchmark
79+
80+ Ensure you have a PostgreSQL server running. You can add connection details using environment vars PGDATABASE, PGUSER etc.
81+
82+ ``` bash
83+ npm install
84+ npm start
85+ ```
0 commit comments