pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix performance problem with new COPY DEFAULT code
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix performance problem with new COPY DEFAULT code
@ 2023-07-27 02:48  David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: David Rowley @ 2023-07-27 02:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix performance problem with new COPY DEFAULT code

9f8377f7a added code to allow COPY FROM insert a column's default value
when the input matches the DEFAULT string specified in the COPY command.

Here we fix some inefficient code which needlessly palloc0'd an array to
store if we should use the default value or input value for the given
column.  This array was being palloc0'd and pfree'd once per row.  It's
much more efficient to allocate this once and just reset the values once
per row.

Reported-by: Masahiko Sawada
Author: Masahiko Sawada
Discussion: https://postgr.es/m/CAD21AoDvDmUQeJtZrau1ovnT_smN940%3DKp6mszNGK3bq9yRN6g%40mail.gmail.com
Backpatch-through: 16, where 9f8377f7a was introduced.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b635ac03e80237838bec8b224eb4dea97985fda3

Modified Files
--------------
src/backend/commands/copyfrom.c      | 1 +
src/backend/commands/copyfromparse.c | 4 +---
2 files changed, 2 insertions(+), 3 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix performance problem with new COPY DEFAULT code
@ 2023-07-27 02:49  David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: David Rowley @ 2023-07-27 02:49 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix performance problem with new COPY DEFAULT code

9f8377f7a added code to allow COPY FROM insert a column's default value
when the input matches the DEFAULT string specified in the COPY command.

Here we fix some inefficient code which needlessly palloc0'd an array to
store if we should use the default value or input value for the given
column.  This array was being palloc0'd and pfree'd once per row.  It's
much more efficient to allocate this once and just reset the values once
per row.

Reported-by: Masahiko Sawada
Author: Masahiko Sawada
Discussion: https://postgr.es/m/CAD21AoDvDmUQeJtZrau1ovnT_smN940%3DKp6mszNGK3bq9yRN6g%40mail.gmail.com
Backpatch-through: 16, where 9f8377f7a was introduced.

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c1308ce2d9224f0ec08128ab35e161837f9a5105

Modified Files
--------------
src/backend/commands/copyfrom.c      | 1 +
src/backend/commands/copyfromparse.c | 4 +---
2 files changed, 2 insertions(+), 3 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2023-07-27 02:49 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-07-27 02:48 pgsql: Fix performance problem with new COPY DEFAULT code David Rowley <drowley@postgresql.org>
2023-07-27 02:49 pgsql: Fix performance problem with new COPY DEFAULT code David Rowley <drowley@postgresql.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox