PostgreSQL network compression for result set

compressionNetworkpostgresql

I was reading about network compression with PostgreSQL to see if there was anything that offered that which would permit big result sets to transfer over the wire to remote web servers. It seems there is nothing of this sort. Is there a solution out there to do that, that isn't SSL?

SSL

It seems at one point there was a solution involving SSL. Having read the threads pertaining to that, it seems that the solution is no longer advisable as it leaves the system vulnerable to a CRIME worldwide bug.

Though not advisable, it seems that you can re-enable SSL Compression at least currently with OPENSSL_DEFAULT_ZLIB but that it will be removed in the future and that it's currently disabled at compiled time in openssl.

no-zlib         [default]
no-zlib-dynamic [default]

Best Answer

This part of the documentation describes how you can do it by first setting up an SSH tunnel (outside of Postgres) and then connecting to that. If you add the -C flag to the ssh command, it should enable compression.

https://www.postgresql.org/docs/current/static/ssh-tunnels.html