Postgres Benchmarks

A set of benchmarks focusing on the performance of Postgres client libraries for Node.js
Alternatives To Postgres Benchmarks
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Leveldb33,852424 days ago4June 24, 2021300bsd-3-clauseC++
LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values.
Fastify29,1541,1312,9182 days ago273October 19, 202387otherJavaScript
Fast and low overhead web framework, for Node.js
Fasthttp20,4096453,4632 days ago186November 12, 202386mitGo
Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http
Benchmarkdotnet9,6041,1251433 days ago65November 01, 2023215mitC#
Powerful .NET library for benchmarking
Frameworkbenchmarks7,195
8 hours ago142otherJava
Source for the TechEmpower Framework Benchmarks project
Bigcache6,902206715a day ago35October 24, 202288apache-2.0Go
Efficient cache for gigabytes of data written in Go.
Web Frameworks6,793
9 hours ago13April 27, 2021195mitPHP
Which is the fastest web framework?
Criterion.rs3,8672454,4238 days ago25May 26, 2023149apache-2.0Rust
Statistics-driven benchmarking library for Rust
Yet Another Bench Script2,995
5 days ago3wtfplShell
YABS - a simple bash script to estimate Linux server performance using fio, iperf3, & Geekbench
Jquery Dynatable2,788
5 years ago1March 31, 2015232otherJavaScript
A more-fun, semantic, alternative to datatables
Alternatives To Postgres Benchmarks
Select To Compare


Alternative Project Comparisons
Readme

Postgres Library Benchmarks for Node.js

This is a set of benchmarks focusing on the performance of Postgres client libraries for Node.js. The benchmarks are primarily direct selects of values to measure the input-output performance and not the Performance of postgres data fetching.

NB. In daily usage it is very likely that this difference doesn't matter as much since the time spent by the client library is negligable compared to the query time itself.

Currently benchmarked libraries are

Results

These are the results from running the benchmarks on a Macbook Pro 2,9 GHz Quad-Core Intel Core i7 with a default Postgres 12.6 installation and Node 12.20.1. The time is the average of 5 rounds, running the queries 10,000 times after some warmup rounds.

client select select_arg select_args select_where
Postgres.js 0.100s (4.8x) 0.105s (7.4x) 0.231s (4.3x) 0.233s (5.1x)
pg-promise 0.360s (1.3x) 0.427s (1.8x) 0.662s (1.5x) 0.801s (1.5x)
pg-promise-native 0.371s (1.3x) 0.435s (1.8x) 0.673s (1.5x) 0.807s (1.5x)
pg 0.322s (1.5x) 0.611s (1.3x) 0.815s (1.2x) 1.057s (1.1x)
pg-native 0.479s (1.0x) 0.551s (1.4x) 0.885s (1.1x) 1.183s (1.0x)
slonik 0.453s (1.1x) 0.773s (1.0x) 0.992s (1.0x) 1.108s (1.1x)

results chart

lower is better

Query descriptions:

select

select 1 as x

select_arg

select $1 as x

-- $1 is just 1

select_args

select
  $1 as int,
  $2 as string,
  $3 as timestamp,
  $4 as null,
  $5 as boolean,
  $6 as bytea,
  $7 as json

--$1 = 1337
--$2 = 'wat'
--$3 = new Date()
--$4 = null
--$5 = false
--$6 = Buffer.from('awesome')
--$7 = "[{ "some": "json" }, { "array": "object" }]"

select_where

select * from pg_catalog.pg_type where typname = $1

--$1 = 'bool'

Running the benchmark

Ensure you have a PostgreSQL server running. You can add connection details using environment vars PGDATABASE, PGUSER etc.

npm install
npm start
Popular Performance Projects
Popular Benchmark Projects
Popular Software Performance Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Javascript
Postgresql
Benchmark
Promise
Performance