Thu Aug 4 11:28:16 2016

Server Performance Benchmark Report

Below are the results of testing PostgreSQL client driver implementations. Each server is constrained to run in a single process. Test environment: Linux 4.4.5 (gentoo 2.2, x86_64) on Intel(R) Xeon(R) CPU E5-1620 v2 @ 3.70GHz.

Overall Results

Individual Benchmarks

1-pg_type.json x8

Test Setup

N/A

Test Query

select typname, typnamespace, typowner, typlen, typbyval, typcategory, typispreferred, typisdefined, typdelim, typrelid, typelem, typarray from pg_type where typtypmod = $1 and typisdefined = $2
Args: [-1, True]

2-generate_series.json x8

Test Setup

N/A

Test Query

SELECT i FROM generate_series(1, $1) AS i
Args: [1000]

3-large_object.json x8

Test Setup

CREATE TABLE _bytes(b bytea); INSERT INTO _bytes(b) (SELECT repeat('a', 1000)::bytea FROM generate_series(1, 100));

Test Query

SELECT * FROM _bytes
Args: []

4-arrays.json x8

Test Setup

CREATE TABLE _test(a int[]); INSERT INTO _test(a) (SELECT (SELECT array_agg(i) FROM generate_series(1, 100) as s(i)) FROM generate_series(1, 100));

Test Query

SELECT * FROM _test
Args: []

Detailed Benchmark Data

Geometric mean 1-pg_type.json x8 2-generate_series.json x8 3-large_object.json x8 4-arrays.json x8
golang-libpq
Queries/sec1944.03 1146.55 3088.59 1142.05 3531.61
Rows/sec473519.93 403587.05 3088589.3 114204.51 353160.72
Min latency1.132ms 1.68ms 0.79ms 0.99ms 1.25ms
Mean latency4.107ms 6.969ms 2.584ms 6.995ms 2.259ms
Max latency16.876ms 19.04ms 12.68ms 21.09ms 15.93ms
Latency variation1.542ms (37.54%) 2.462ms (35.33%) 0.916ms (35.46%) 3.221ms (46.04%) 0.778ms (34.44%)
golang-pgx
Queries/sec2607.42 1423.57 2987.77 9446.27 1150.42
Rows/sec635105.68 501095.89 2987772.79 944627.42 115041.63
Min latency0.598ms 1.01ms 0.64ms 0.13ms 1.52ms
Mean latency3.056ms 5.605ms 2.668ms 0.841ms 6.939ms
Max latency11.246ms 20.77ms 12.94ms 3.72ms 16.0ms
Latency variation1.46ms (47.78%) 2.687ms (47.93%) 1.347ms (50.5%) 0.461ms (54.79%) 2.726ms (39.29%)
python-aiopg
Queries/sec234.19 89.0 128.7 648.78 404.75
Rows/sec57041.22 31326.47 128695.21 64877.62 40474.97
Min latency6.915ms 13.38ms 9.77ms 3.47ms 5.04ms
Mean latency34.076ms 89.534ms 61.957ms 12.313ms 19.74ms
Max latency39.476ms 95.0ms 68.94ms 16.71ms 22.19ms
Latency variation1.18ms (3.46%) 4.327ms (4.83%) 2.887ms (4.66%) 0.346ms (2.81%) 0.449ms (2.27%)
python-aiopg-tuples
Queries/sec1172.23 1136.51 2364.31 1335.1 526.33
Rows/sec285527.42 400051.01 2364314.5 133509.79 52632.93
Min latency3.32ms 3.99ms 2.44ms 3.16ms 3.95ms
Mean latency6.813ms 7.029ms 3.375ms 5.982ms 15.182ms
Max latency9.187ms 12.2ms 4.44ms 7.0ms 18.79ms
Latency variation0.228ms (3.35%) 0.425ms (6.04%) 0.209ms (6.18%) 0.105ms (1.75%) 0.292ms (1.92%)
python-asyncpg
Queries/sec3740.3 2985.2 3137.19 9092.71 2298.36
Rows/sec911049.59 1050789.89 3137186.62 909271.36 229836.14
Min latency1.025ms 1.23ms 1.53ms 0.32ms 1.83ms
Mean latency2.129ms 2.67ms 2.542ms 0.872ms 3.471ms
Max latency10.24ms 10.31ms 12.74ms 7.01ms 11.94ms
Latency variation0.517ms (24.29%) 0.507ms (18.97%) 1.312ms (51.63%) 0.157ms (18.01%) 0.686ms (19.75%)
nodejs-pg
Queries/sec389.56 660.63 532.11 1275.6 51.36
Rows/sec94887.84 232541.33 532110.06 127560.31 5136.0
Min latency5.814ms 2.91ms 3.68ms 3.67ms 29.08ms
Mean latency20.469ms 12.098ms 15.012ms 6.263ms 154.331ms
Max latency56.154ms 30.28ms 56.93ms 19.68ms 293.08ms
Latency variation6.471ms (31.61%) 3.446ms (28.48%) 5.151ms (34.31%) 2.03ms (32.41%) 48.673ms (31.54%)
nodejs-pg-native
Queries/sec493.69 296.77 2160.42 1626.36 56.97
Rows/sec120253.86 104463.23 2160417.87 162635.68 5697.43
Min latency4.895ms 5.68ms 1.65ms 2.53ms 24.21ms
Mean latency16.153ms 26.908ms 3.699ms 4.914ms 139.205ms
Max latency32.616ms 43.59ms 11.51ms 9.3ms 242.55ms
Latency variation2.917ms (18.05%) 5.626ms (20.91%) 1.172ms (31.69%) 0.329ms (6.69%) 33.365ms (23.97%)