Skip to content

Data Types: 23 PostgreSQL Types, 1 to 500 Rows ​

Benchmark · November 2026 · Data types

Before you trust these numbers

  • The author of NpgsqlRest runs this benchmark, and NpgsqlRest is one of the services in it.
  • The analysis was written with AI assistance from the raw data, then reviewed and edited.
  • Every test ran once, on one machine. Treat differences of a few percent as a tie.
  • Everything is public so you can check it: the code of every service, the data, and everything that went wrong, and how to run it yourself. Corrections and pull requests are welcome.
Highlight:

What this test does ​

The service calls a function that returns rows with 23 columns, one for almost every PostgreSQL type an API meets: text, integers of three sizes, numeric, real and double, boolean, date, time, timestamps with and without a time zone, interval, uuid, json and jsonb, arrays, and nulls. The request carries 16 typed parameters in the query string. It is run for 1, 10, 100 and 500 rows, at 1, 50, 100 and 200 users at the same time.

This is the broadest test of the series: reading typed parameters, binding them, reading every kind of value from the database and writing it as JSON. A service that is fast here has no slow type.

The code that ran: the load script script.js, the PostgreSQL function in init.sql (for the NpgsqlRest SQL file services: perf-test.sql), and each service's own source, linked from Every Service, One Scorecard.

How to read the charts

  • A bar is requests answered per second. Longer is faster. The fastest service is at the top.
  • A "k6 limit" or "PG limit" tag means the load generator (k6, the tool that sends the requests) or the database ran out of CPU before the service did. That service could have gone faster than its bar shows.
  • The Highlight buttons above keep one platform highlighted in every chart of the series.

With 100 and 500 rows, the load generator is the limit

Every response is parsed and checked by the load generator. With 100 or 500 rows of 23 columns that costs it more than producing the response costs the service: in these tests the load generator was out of CPU on its 12 cores for most services (the k6 limit tag), and the fastest services end up within a few percent of each other. Services that return JSON, arrays and numbers as plain strings give the load generator less to parse, which is why Swoole leads several of these tables. Read the 1 and 10 row tests for what the services can do, and the 100 and 500 row tests as "all of these are faster than this".

What the numbers say ​

  • With 1 and 10 rows the leading group is NpgsqlRest, Go and Rust. At 100 users and 10 rows the first nine services are within 9% of each other: six NpgsqlRest variants, Gin and the two Rust services.
  • Among generated APIs the gap is large. NpgsqlRest 4.1 (AOT, functions) does 3.9 times the requests of PostgREST in the main test, 8.9 times those of Hasura and 6.4 times those of PostGraphile.
  • One row at 100 users is the cleanest comparison of speed on this page: NpgsqlRest 3.21 JIT · SQL files leads with 27,928 requests per second, followed by NpgsqlRest 3.21 AOT · SQL files and NpgsqlRest 4.1 JIT · SQL files.
  • With 100 and 500 rows the table is flat at the top, for the reason in the box above.

Of the 496 tests on this page, the service was out of CPU in 131, the load generator in 170, PostgreSQL in 41, and nothing in 154 (in those, the number of users set the pace, not a lack of CPU). A throughput number says how much a service can carry only where the service itself was out of CPU.

Compare the services ​

Pick a test with the buttons. Choose the number of users and the size, and what to look at: requests per second, how slow the slowest requests are, memory, or requests per CPU core. The chart starts on the main test of this kind (100 users, 10 rows), which the summary tables of the series use.

Users at the same time
Rows in the response
Show
Requests per second: 100 users, 10 rows

↑ longer bar is betterHow many requests each service answered per second, with 100 users sending requests at the same time.

  1. 1NpgsqlRest 4.1 JIT · SQL files16,948req/sk6 limit
  2. 2Gin 1.12 (Go)16,896req/sk6 limit
  3. 3NpgsqlRest 4.1 JIT · functions15,940req/sk6 limit
  4. 4NpgsqlRest 3.21 JIT · SQL files15,934req/s
  5. 5NpgsqlRest 4.1 AOT · SQL files15,861req/sk6 limit
  6. 6NpgsqlRest 4.1 AOT · functions15,681req/sk6 limit
  7. 7Axum 0.8 (Rust)15,564req/sPG limit
  8. 8NpgsqlRest 3.21 JIT · functions15,478req/s
  9. 9Actix-web 4.20 (Rust)15,433req/sPG limit
  10. 10.NET 10 · plain Npgsql15,417req/sk6 limit
  11. 11.NET 10 · Dapper15,374req/sk6 limit
  12. 12Bun 1.415,325req/sk6 limit
  13. 13NpgsqlRest 3.21 AOT · SQL files15,316req/s
  14. 14.NET 11 · plain Npgsql15,292req/sk6 limit
  15. 15.NET 11 · Dapper15,286req/sPG limit
  16. 16NpgsqlRest 3.21 AOT · functions15,171req/s
  17. 17Deno 2.914,889req/s
  18. 18Spring Boot 4.2 (Java 25)14,165req/s
  19. 19Swoole 6.2 (PHP)13,913req/s
  20. 20Go 1.27 · net/http13,690req/s
  21. 21Fastify 5.1210,809req/s
  22. 22.NET 11 · EF Core10,375req/s
  23. 23.NET 10 · EF Core10,111req/s
  24. 24NestJS 12.69,351req/s
  25. 25Express 5.37,733req/s
  26. 26PostgREST 16.64,027req/s
  27. 27FastAPI 0.1652,800req/s
  28. 28PostGraphile 5.2 (GraphQL)2,465req/sk6 limit
  29. 29Django 6.11,788req/s
  30. 30Hasura 2.50 (GraphQL)1,767req/s
  31. 31Laravel Octane 13.431,527req/s

The code of this test:the script that sends the requests · the PostgreSQL function it calls · the same as a SQL file. Click a service's name (↗) to open its own code for this test.

At 100 users at the same time, 10 rows, NpgsqlRest 4.1 JIT · SQL files is first with 16,948 requests per second, 0.3% ahead of Gin 1.12 (Go). 15 of the 31 services are within 10% of the leader, and the slowest does 1,527.

The best of each platform ​

The fastest service of every platform in the main test (100 users, 10 rows). "Compared with the fastest" is its requests per second as a percentage of the service in first place.

PlatformIts fastest servicePlace among the 31Requests per secondCompared with the fastestIts code
NpgsqlRestNpgsqlRest 4.1 JIT · SQL files116,948100%appsettings.json
GoGin 1.12 (Go)216,896100%main.go
RustAxum 0.8 (Rust)715,56492%main.rs
.NET.NET 10 · plain Npgsql1015,41791%Program.cs
Bun & DenoBun 1.41215,32590%app.ts
JavaSpring Boot 4.2 (Java 25)1814,16584%Application.java
PHPSwoole 6.2 (PHP)1913,91382%server.php
Node.jsFastify 5.122110,80964%app.js
PostgRESTPostgREST 16.6264,02724%postgrest.conf
PythonFastAPI 0.165272,80017%app.py
GraphQLPostGraphile 5.2 (GraphQL)282,46515%graphile.config.mjs

Every measurement of the main test ​

Latency, CPU, memory and time in PostgreSQL for all 31 services
#ServiceRequests/sMedian msp99 msCPU cores usedRequests/s per corePeak memory MBTime in PostgreSQLOut of CPU
1NpgsqlRest 4.1 JIT · SQL files16,9483.4716.92.746,1821433%k6
2Gin 1.12 (Go)16,8963.9316.03.205,273523%k6
3NpgsqlRest 4.1 JIT · functions15,9404.0616.82.566,2171143%k6
4NpgsqlRest 3.21 JIT · SQL files15,9344.0817.23.644,3791433%service
5NpgsqlRest 4.1 AOT · SQL files15,8614.0717.33.115,102913%k6
6NpgsqlRest 4.1 AOT · functions15,6814.3416.33.045,156863%k6
7Axum 0.8 (Rust)15,5644.4615.92.785,602163%PostgreSQL
8NpgsqlRest 3.21 JIT · functions15,4784.3916.43.574,3331543%service
9Actix-web 4.20 (Rust)15,4334.5215.92.685,750173%PostgreSQL
10.NET 10 · plain Npgsql15,4174.4116.73.304,6651072%k6
11.NET 10 · Dapper15,3744.4416.63.384,5481152%k6
12Bun 1.415,3254.2517.13.354,5781813%k6
13NpgsqlRest 3.21 AOT · SQL files15,3164.5716.43.544,322893%service
14.NET 11 · plain Npgsql15,2924.3716.82.785,5061102%k6
15.NET 11 · Dapper15,2864.4216.52.905,2731072%PostgreSQL
16NpgsqlRest 3.21 AOT · functions15,1714.5316.23.444,408913%service
17Deno 2.914,8894.6416.93.444,3293693%service
18Spring Boot 4.2 (Java 25)14,1655.0517.83.743,7921,1043%service
19Swoole 6.2 (PHP)13,9136.2812.03.783,681382%service
20Go 1.27 · net/http13,6905.5217.23.703,704462%service
21Fastify 5.1210,8098.4612.93.802,8464272%service
22.NET 11 · EF Core10,3758.3816.63.792,7371411%service
23.NET 10 · EF Core10,1118.6515.63.782,6771501%service
24NestJS 12.69,35110.1813.33.822,4514851%service
25Express 5.37,73311.2416.93.881,9924291%service
26PostgREST 16.64,02722.4130.32.631,531651%—
27FastAPI 0.1652,80033.4652.43.907182030%service
28PostGraphile 5.2 (GraphQL)2,4658.50100.82.629397402%k6
29Django 6.11,78852.1883.83.515102721%service
30Hasura 2.50 (GraphQL)1,76756.2964.02.427311991%—
31Laravel Octane 13.431,52758.21120.13.824005620%service

"CPU cores used" is the average CPU of the service during the test (it may use 4). "Time in PostgreSQL" is the share of an average request that PostgreSQL spent executing the statement.

All tests of this kind ​

Requests per second of every service in every test of this kind. Each column is one test; a higher number is better.

1 row

Service1 users, 1 row50 users, 1 row100 users, 1 row200 users, 1 row
NpgsqlRest 3.21 JIT · SQL files63827,07327,92828,572
NpgsqlRest 4.1 JIT · SQL files66826,37627,208ᵖ28,224ᵖ
NpgsqlRest 3.21 AOT · SQL files61525,84027,41127,673
NpgsqlRest 4.1 AOT · SQL files63423,91625,91326,931
Bun 1.476224,481ᵖ25,089ᵖ25,327ᵖ
Deno 2.967424,197ᵖ24,62525,312
Gin 1.12 (Go)70124,169ᵖ24,446ᵖ24,778ᵖ
NpgsqlRest 3.21 JIT · functions61920,97221,39221,732ᵖ
NpgsqlRest 4.1 JIT · functions64920,789ᵖ21,263ᵖ21,694ᵖ
NpgsqlRest 3.21 AOT · functions56320,110ᵖ21,387ᵖ21,681ᵖ
NpgsqlRest 4.1 AOT · functions62420,419ᵖ21,134ᵖ21,542ᵖ
Fastify 5.1257120,51121,18520,940
Spring Boot 4.2 (Java 25)61421,04821,90520,223
Go 1.27 · net/http59419,05320,63320,220
.NET 10 · Dapper59119,296ᵖ19,37019,589ᵖ
.NET 10 · plain Npgsql60919,40019,366ᵖ19,580ᵖ
.NET 11 · Dapper57019,138ᵖ19,320ᵖ19,566ᵖ
.NET 11 · plain Npgsql65019,176ᵖ19,301ᵖ19,532ᵖ
Swoole 6.2 (PHP)77717,269ᵖ18,58219,161
Actix-web 4.20 (Rust)67418,356ᵖ17,991ᵖ18,300ᵖ
Axum 0.8 (Rust)76818,559ᵖ18,081ᵖ18,290ᵖ
NestJS 12.651316,49016,68717,197
.NET 11 · EF Core41112,80513,26613,129
Express 5.357112,26612,68612,711
.NET 10 · EF Core42412,05512,75312,553
PostGraphile 5.2 (GraphQL)3106,7867,0026,238
FastAPI 0.1656485,6185,9955,930
PostgREST 16.63924,4204,2944,285
Django 6.12492,1212,0812,022
Hasura 2.50 (GraphQL)2691,9641,9341,794
Laravel Octane 13.432851,6341,6281,643

10 rows

Service1 users, 10 rows50 users, 10 rows100 users, 10 rows200 users, 10 rows
NpgsqlRest 4.1 JIT · SQL files43216,38216,948ᵏ16,385ᵏ
Gin 1.12 (Go)44415,54516,896ᵏ17,293ᵏ
NpgsqlRest 4.1 JIT · functions36915,03315,940ᵏ16,369ᵏ
NpgsqlRest 3.21 JIT · SQL files43215,02215,93416,212
NpgsqlRest 4.1 AOT · SQL files41815,53915,861ᵏ16,170ᵏ
NpgsqlRest 4.1 AOT · functions39514,15715,681ᵏ16,134ᵏ
Axum 0.8 (Rust)30414,157ᵖ15,564ᵖ15,820ᵏ
NpgsqlRest 3.21 JIT · functions37514,39915,47816,042
Actix-web 4.20 (Rust)28713,901ᵖ15,433ᵖ15,818ᵏ
.NET 10 · plain Npgsql37514,21115,417ᵏ16,021ᵏ
.NET 10 · Dapper41814,13215,374ᵏ16,041
Bun 1.442214,00115,325ᵏ15,283ᵏ
NpgsqlRest 3.21 AOT · SQL files40614,11815,31615,682
.NET 11 · plain Npgsql37813,85015,292ᵏ15,828ᵏ
.NET 11 · Dapper40813,99415,286ᵖ15,995ᵏ
NpgsqlRest 3.21 AOT · functions35414,23415,17115,855
Deno 2.935013,70114,88915,049
Spring Boot 4.2 (Java 25)32813,27814,16513,416
Swoole 6.2 (PHP)28813,30813,91313,718
Go 1.27 · net/http36512,56613,69013,685
Fastify 5.1240210,50310,80910,981
.NET 11 · EF Core3129,84510,37510,321
.NET 10 · EF Core3079,57510,1119,917
NestJS 12.63599,2229,3519,416
Express 5.33307,5927,7337,765
PostgREST 16.61944,2134,0273,986
FastAPI 0.1653012,7302,8002,801
PostGraphile 5.2 (GraphQL)1232,392ᵏ2,465ᵏ2,490ᵏ
Django 6.12191,8201,7881,746
Hasura 2.50 (GraphQL)2181,8291,7671,695
Laravel Octane 13.431901,5281,5271,535

100 rows

Service1 users, 100 rows50 users, 100 rows100 users, 100 rows200 users, 100 rows
Swoole 6.2 (PHP)1032,806ᵏ2,920ᵏ2,958ᵏ
Go 1.27 · net/http1012,277ᵏ2,384ᵏ2,420ᵏ
Gin 1.12 (Go)1012,285ᵏ2,390ᵏ2,416ᵏ
NpgsqlRest 4.1 AOT · functions1032,055ᵏ2,142ᵏ2,193ᵏ
NpgsqlRest 3.21 JIT · functions1012,052ᵏ2,147ᵏ2,192ᵏ
Axum 0.8 (Rust)932,040ᵏ2,159ᵏ2,189ᵏ
NpgsqlRest 4.1 JIT · SQL files1082,063ᵏ2,137ᵏ2,185ᵏ
.NET 11 · EF Core972,037ᵏ2,145ᵏ2,185ᵏ
NpgsqlRest 4.1 JIT · functions1042,033ᵏ2,155ᵏ2,182ᵏ
.NET 10 · EF Core972,040ᵏ2,147ᵏ2,181ᵏ
NpgsqlRest 3.21 JIT · SQL files1062,051ᵏ2,155ᵏ2,181ᵏ
Actix-web 4.20 (Rust)902,054ᵏ2,156ᵏ2,175ᵏ
.NET 11 · plain Npgsql962,034ᵏ2,142ᵏ2,175ᵏ
.NET 11 · Dapper952,008ᵏ2,134ᵏ2,174ᵏ
NpgsqlRest 4.1 AOT · SQL files1062,034ᵏ2,161ᵏ2,174ᵏ
.NET 10 · Dapper942,024ᵏ2,172ᵏ2,173ᵏ
.NET 10 · plain Npgsql942,054ᵏ2,138ᵏ2,173ᵏ
Spring Boot 4.2 (Java 25)872,040ᵏ2,130ᵏ2,165ᵏ
NpgsqlRest 3.21 AOT · functions1002,023ᵏ2,123ᵏ2,163ᵏ
NpgsqlRest 3.21 AOT · SQL files1042,025ᵏ2,131ᵏ2,158ᵏ
PostgREST 16.6681,997ᵏ2,102ᵏ2,143ᵏ
Deno 2.9921,802ᵏ1,907ᵏ1,936ᵏ
Bun 1.4911,802ᵏ1,902ᵏ1,934ᵏ
Fastify 5.12931,8221,8931,907
NestJS 12.6901,7611,8141,835
Express 5.3891,6981,7421,759
Hasura 2.50 (GraphQL)741,8711,6041,546
Laravel Octane 13.43781,0271,0641,058
Django 6.178822809806
FastAPI 0.16576460465465
PostGraphile 5.2 (GraphQL)20268ᵏ275ᵏ279ᵏ

500 rows

Service1 users, 500 rows50 users, 500 rows100 users, 500 rows200 users, 500 rows
Swoole 6.2 (PHP)27616ᵏ644ᵏ670ᵏ
Go 1.27 · net/http24512ᵏ531ᵏ537ᵏ
Gin 1.12 (Go)24507ᵏ528ᵏ535ᵏ
Laravel Octane 13.4325494503504
Actix-web 4.20 (Rust)23452ᵏ470ᵏ478ᵏ
Axum 0.8 (Rust)23452ᵏ470ᵏ478ᵏ
NpgsqlRest 4.1 AOT · functions26460ᵏ476ᵏ478ᵏ
.NET 11 · plain Npgsql24454ᵏ470ᵏ478ᵏ
NpgsqlRest 3.21 AOT · functions26458ᵏ476ᵏ477ᵏ
.NET 11 · EF Core25459ᵏ474ᵏ476ᵏ
NpgsqlRest 3.21 JIT · functions26460ᵏ477ᵏ476ᵏ
NpgsqlRest 4.1 JIT · functions26458ᵏ476ᵏ476ᵏ
NpgsqlRest 4.1 AOT · SQL files26459ᵏ477ᵏ476ᵏ
.NET 10 · plain Npgsql24453ᵏ472ᵏ476ᵏ
NpgsqlRest 3.21 AOT · SQL files26459ᵏ477ᵏ476ᵏ
NpgsqlRest 3.21 JIT · SQL files26460ᵏ475ᵏ476ᵏ
.NET 10 · Dapper24451ᵏ471ᵏ475ᵏ
.NET 10 · EF Core26460ᵏ476ᵏ475ᵏ
PostgREST 16.619449ᵏ464ᵏ475ᵏ
Hasura 2.50 (GraphQL)22457ᵏ477ᵏ475ᵏ
NpgsqlRest 4.1 JIT · SQL files27460ᵏ476ᵏ475ᵏ
.NET 11 · Dapper24446ᵏ462ᵏ474ᵏ
Spring Boot 4.2 (Java 25)21452ᵏ468ᵏ472ᵏ
Deno 2.922406ᵏ420ᵏ424ᵏ
Bun 1.422406ᵏ418ᵏ424ᵏ
Express 5.322364345329
Fastify 5.1222371352328
NestJS 12.622362328315
Django 6.117212217212
FastAPI 0.16516979696
PostGraphile 5.2 (GraphQL)457ᵏ58ᵏ58ᵏ

Bold is the best of the column. ᵏ the load generator was out of CPU in that test and the service was not; ᵖ the same for PostgreSQL.


Previous: ← Overall Results · Next: Minimal Request →

Comments