pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jonathan Marks <jonathanaverymarks@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Rapid disk usage spikes when updating large tables with GIN indexes
Date: Mon, 14 May 2018 15:08:15 -0400
Message-ID: <31807.1526324895@sss.pgh.pa.us> (raw)
In-Reply-To: <E8C1D0E3-36F4-4FFF-A4DF-9E6F896DD7FC@gmail.com>
References: <F16EF890-B574-487B-973F-4D8C13366DAB@gmail.com>
	<26217.1526318186@sss.pgh.pa.us>
	<E8C1D0E3-36F4-4FFF-A4DF-9E6F896DD7FC@gmail.com>

[ please keep the list cc'd ]

Jonathan Marks <jonathanaverymarks@gmail.com> writes:
> Thanks for your quick reply. Here’s a bit more information:
> 1) to measure the “size of the database” we run something like `select datname, pg_size_pretty(pg_database_size(datname)) from pg_database;` I’m not sure if this includes WAL size.
> 2) I’ve tried measuring WAL size with `select sum(size) from pg_ls_waldir();` — this also doesn’t budge.
> 3) Our current checkpoint_timeout is 600s with a checkpoint_completion_target of 0.9 — what does that suggest?

Hmph.  Your WAL-size query seems on point, and that pretty much destroys
my idea about a WAL emission spike.

pg_database_size() should include all regular and temporary tables/indexes
in the named DB.  It doesn't include WAL (but we've eliminated that), nor
cluster-wide tables such as pg_database (but those seem pretty unlikely
to be at issue), nor non-relation temporary files such as sort/hash temp
space.  At this point I think we have to focus our attention on what might
be creating large temp files.  I do not see anything in the GIN index code
that could do that, especially not if you have fastupdate off.  I wonder
whether there is something about the particular bulk-insertion queries
you're using that could result in large temp files --- which'd make the
apparent correlation with GIN index use a mirage, but we're running out
of other ideas.  You could try enabling log_temp_files to see if there's
anything to that.

In the grasping-at-straws department: are you quite sure that the extra
disk space consumption is PG's to begin with, rather than something
outside the database entirely?

			regards, tom lane




view thread (8+ messages)  latest in thread

Message-ID: <31807.1526324895@sss.pgh.pa.us>
Permalink:  ../31807.1526324895@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/31807.1526324895@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jonathanaverymarks@gmail.com
  Subject: Re: Rapid disk usage spikes when updating large tables with GIN indexes
  In-Reply-To: <31807.1526324895@sss.pgh.pa.us>
  References: <F16EF890-B574-487B-973F-4D8C13366DAB@gmail.com> <26217.1526318186@sss.pgh.pa.us> <E8C1D0E3-36F4-4FFF-A4DF-9E6F896DD7FC@gmail.com> <31807.1526324895@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