Benchmark of using JSON to transport query results in node.js - Mailing list pgsql-general

From Mitar
Subject Benchmark of using JSON to transport query results in node.js
Date
Msg-id CAKLmikO1y8LD+8Ugd+cwUW0JWj36tmPfAfn+M33d1G2MHhiOOA@mail.gmail.com
Whole thread Raw
Responses Re: Benchmark of using JSON to transport query results in node.js  (Tony Shelver <tshelver@gmail.com>)
List pgsql-general
Hi!

I made some benchmarks of using JSON to transport results to node.js
and it seems it really makes a difference over using native or
standard PostgreSQL. So the idea is that you simply wrap all results
into JSON like SELECT to_json(t) FROM (... original query ...) AS t. I
am guessing because node.js/JavaScript has really fast JSON parser but
for everything else there is overhead. See my blog post for more
details [1]. Any feedback welcome.

This makes me wonder. If serialization/deserialization makes such big
impact, where there efforts to improve how results are serialized for
over-the-wire transmission? For example, to use something like
Capnproto [2] to serialize into structure which can be directly used
without any real deserialization?

[1] https://mitar.tnode.com/post/181893159351/in-nodejs-always-query-in-json-from-postgresql
[2] https://capnproto.org/


Mitar

-- 
http://mitar.tnode.com/
https://twitter.com/mitar_m


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: log level of "drop cascade" lists
Next
From: Tony Shelver
Date:
Subject: Re: Benchmark of using JSON to transport query results in node.js