Re: [PATCH] Remove Extra palloc Of raw_buf For Binary Format In COPY FROM

From: Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Remove Extra palloc Of raw_buf For Binary Format In COPY FROM
Date: 2020-06-26 12:45:02
Message-ID: CAGPqQf0G7Q=ceN3Mq1na76nMmH65a253F6FX74t7N2MfZG+euQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jun 26, 2020 at 3:16 PM Bharath Rupireddy <
bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:

> Hi Hackers,
>
> There seems to be an extra palloc of 64KB of raw_buf for binary format
> files which is not required
> as copy logic for binary files don't use raw_buf, instead, attribute_buf
> is used in CopyReadBinaryAttribute.
>

+1

I looked at the patch and the changes looked good. Couple of comments;

1)

+
+ /* For binary files raw_buf is not used,
+ * instead, attribute_buf is used in
+ * CopyReadBinaryAttribute. Hence, don't palloc
+ * raw_buf.
+ */

Not a PG style of commenting.

2) In non-binary mode, should assign NULL the raw_buf.

Attaching patch with those changes.

> Attached is a patch, which places a check to avoid this unnecessary 64KB
> palloc.
>
> Request the community to take this patch, if it is useful.
>
> With Regards,
> Bharath Rupireddy.
> EnterpriseDB: http://www.enterprisedb.com
>

Thanks,
Rushabh Lathia
www.EnterpriseDB.com

Attachment Content-Type Size
v2-0001-Remove-Extra-palloc-Of-raw_buf-For-Binary-Format-.patch text/x-patch 794 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2020-06-26 12:46:41 Re: [Patch] ALTER SYSTEM READ ONLY
Previous Message Robert Haas 2020-06-26 12:39:01 Re: xid wraparound danger due to INDEX_CLEANUP false