@@ -6,10 +6,12 @@ This is a set of benchmarks focusing on the performance of Postgres client libra
6
6
7
7
Currently benchmarked libraries are
8
8
9
- - [ postgres ] ( https://github.com/porsager/postgres )
9
+ - [ Postgres.js ] ( https://github.com/porsager/postgres )
10
10
- [ pg-promise] ( https://github.com/vitaly-t/pg-promise )
11
11
- [ pg] ( https://github.com/brianc/node-postgres )
12
12
- [ pg-native] ( https://github.com/brianc/node-pg-native )
13
+ - [ slonik] ( https://github.com/gajus/slonik )
14
+
13
15
14
16
## Results
15
17
@@ -18,12 +20,12 @@ The time is the average of 5 rounds, running the queries 10,000 times after some
18
20
19
21
client | select | select_arg | select_args | select_where
20
22
:--------- | -------------: | -------------: | -------------: | -------------:
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)
27
29
28
30
![ results chart] ( results.png )
29
31
> lower is better
@@ -72,3 +74,12 @@ select * from pg_catalog.pg_type where typname = $1
72
74
-- $1 = 'bool'
73
75
```
74
76
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