pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: kurt@roeckx.be
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16443: Too much memory usage on insert query
Date: Sun, 17 May 2020 11:40:53 -0400
Message-ID: <1360.1589730053@sss.pgh.pa.us> (raw)
In-Reply-To: <16443-030629aae2859708@postgresql.org>
References: <16443-030629aae2859708@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> I was executing this query:
> insert into ct_entry_chain (ct_entry_id, certificate_id) select id,
> unnest(certificate_chain_id) from ct_entry;

How much data is that?

> The process was using at least 14 GB, of the 8 GB of RAM that's available.

My first guess is that the space was being eaten by trigger list entries
to verify the foreign-key constraints on the target table.  You might be
better advised to fill the new table first and then create its FK
constraints.  (Building the indexes afterwards wouldn't be a bad idea,
either.)

We are looking at better mechanisms for handling FK verification, but
that won't see the light of day before v14 at the earliest.

			regards, tom lane





view thread (4+ messages)  latest in thread

Message-ID: <1360.1589730053@sss.pgh.pa.us>
Permalink:  ../1360.1589730053@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1360.1589730053@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, kurt@roeckx.be, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16443: Too much memory usage on insert query
  In-Reply-To: <1360.1589730053@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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