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

On Sun, May 17, 2020 at 11:40:53AM -0400, Tom Lane wrote:
> 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 ct_entry table contains 305 GB data over about 2.1e9 rows.
certificate_chain_id contains about 2.2 entries per row.

> > 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.

I will try that, thanks.


Kurt






view thread (4+ messages)

Message-ID: <20200517160150.GJ2915@roeckx.be>
Permalink:  ../20200517160150.GJ2915@roeckx.be/
Also on:    postgresql.org/message-id/20200517160150.GJ2915@roeckx.be

 · 

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: kurt@roeckx.be, tgl@sss.pgh.pa.us, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16443: Too much memory usage on insert query
  In-Reply-To: <20200517160150.GJ2915@roeckx.be>

* 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