Re: libpq compression (part 3) - Mailing list pgsql-hackers

From Robert Haas
Subject Re: libpq compression (part 3)
Date
Msg-id CA+TgmobS=813B+7XZ+h-w2H8HZd0EAn-ug7HV2D7DF2FRTrTzQ@mail.gmail.com
Whole thread Raw
In response to Re: libpq compression (part 3)  (Jacob Burroughs <jburroughs@instructure.com>)
Responses Re: libpq compression (part 3)
List pgsql-hackers
On Wed, May 15, 2024 at 12:24 PM Jacob Burroughs
<jburroughs@instructure.com> wrote:
> > But now I'm wondering whether these options should really be symmetric
> > on the client and server sides? Isn't it for the server just to
> > specify a list of acceptable algorithms, and the client to set the
> > compression options? If both sides are trying to set the compression
> > level, for example, who wins?
>
> Compression options really only ever apply to the side doing the
> compressing, and at least as I had imagined things each party
> (client/server) only used its own level/other compression params.
> That leaves me thinking, maybe we really want two independent GUCs,
> one for "what algorithms are enabled/negotiable" and one for "how
> should I configure my compressors" and then we reduce the dimensions
> we are trying to shove into one GUC and each one ends up with a very
> clear purpose:
> connection_compression=(yes|no|alg1,alg2:server_to_client=alg1,alg2:client_to_server=alg3)
> connection_compression_opts=gzip:level=2

From my point of view, it's the client who knows what it wants to do
with the connection. If the client plans to read a lot of data, it
might want the server to compress that data, especially if it knows
that it's on a slow link. If the client plans to send a lot of data --
basically COPY, I'm not thinking this is going to matter much
otherwise -- then it might want to compress that data before sending
it, again, especially if it knows that it's on a slow link.

But what does the server know, really? If some client connects and
sends a SELECT query, the server can't guess whether that query is
going to return 1 row or 100 million rows, so it has no idea of
whether compression is likely to make sense or not. It is entitled to
decide, as a matter of policy, that it's not willing to perform
compression, either because of CPU consumption or security concerns or
whatever, but it has no knowledge of what the purpose of this
particular connection is.

--
Robert Haas
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Jacob Burroughs
Date:
Subject: Re: libpq compression (part 3)
Next
From: Robert Haas
Date:
Subject: Re: GenBKI emits useless open;close for catalogs without rows