Re: Binary COPY IN size reduction

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Lőrinc Pap <lorinc(at)gradle(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Binary COPY IN size reduction
Date: 2020-04-24 14:19:23
Message-ID: 23116.1587737963@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

=?UTF-8?Q?L=C5=91rinc_Pap?= <lorinc(at)gradle(dot)com> writes:
> We've switched recently from TEXT based COPY to the BINARY one.
> We've noticed a slight performance increase, mostly because we don't need
> to escape the content anymore.
> Unfortunately the binary protocol's output ended up being slightly bigger
> than the text one (e.g. for one payload it's *373MB* now, was *356MB* before)
> ...
> By skipping the column count and sizes for every row, in our example this
> change would reduce the payload to *332MB* (most of our payload is binary,
> lightweight structures consisting of numbers only could see a >*2x*
> decrease in size).

TBH, that amount of gain does not seem to be worth the enormous
compatibility costs of introducing a new COPY data format. What you
propose also makes the format a great deal less robust (readers are
less able to detect errors), which has other costs. I'd vote no.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2020-04-24 14:45:01 Re: [PATCH'] Variables assigned with values that is never used.
Previous Message Tom Lane 2020-04-24 14:07:17 Re: proposal - plpgsql - all plpgsql auto variables should be constant