pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: rotten@windfish.net
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14290: materialized view refresh doesn't use temp_tablespace
Date: Wed, 24 Aug 2016 19:58:37 +0100
Message-ID: <87shtu9ewv.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <20160818190623.1529.12440@wrigleys.postgresql.org>
References: <20160818190623.1529.12440@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

>>>>> "rotten" == rotten  <rotten@windfish.net> writes:

 rotten> I've recently observed that if while refreshing a materialized
 rotten> view, temp space is required, it will not use the default
 rotten> temp_tablespaces defined in postgresql.conf.  Instead it uses
 rotten> the tablespace where the materialized view lives.

 rotten> This surprised me the other day when my production database ran
 rotten> out of disk space.  I was able to confirm the behavior in my
 rotten> development environment.

 rotten> To reproduce:
 rotten> 1) Set up a temp tablespace.
 rotten> 2) Configure temp_tablespaces in postgrsql.conf to use that tablespace.
 rotten> 3) Turn on logging of tablespace names.
 rotten> 4) Reduce work_mem (so that temp space is more likely to be required).
 rotten> 5) Bounce the DB, or reload the postgresql.conf
 rotten> 6) Refresh a fairly large materialized view.
 rotten> 7) Observe in the logs where the temp tablespace was created.

I can't reproduce this.

postgres=# show server_version;
 server_version 
----------------
 9.5.4

postgres=# create materialized view mvx1 as select * from generate_series(1,100000);
SELECT 100000
postgres=# set temp_tablespaces = 't1';
SET
postgres=# set log_temp_files = 0;
SET
postgres=# set work_mem = '64kB';
SET

postgres=# refresh materialized view mvx1;
LOG:  temporary file: path "pg_tblspc/18002/PG_9.5_201510051/pgsql_tmp/pgsql_tmp91239.1", size 1400000
STATEMENT:  refresh materialized view mvx1;
REFRESH MATERIALIZED VIEW

(this clearly shows that the temp file created by the FunctionScan of
generate_series is located in tablespace oid 18002, which happens to be
t1)

-- 
Andrew (irc:RhodiumToad)


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (11+ messages)  latest in thread

Message-ID: <87shtu9ewv.fsf@news-spur.riddles.org.uk>
Permalink:  ../87shtu9ewv.fsf@news-spur.riddles.org.uk/
Also on:    postgresql.org/message-id/87shtu9ewv.fsf@news-spur.riddles.org.uk

 · 

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-bugs@postgresql.org
  Cc: andrew@tao11.riddles.org.uk, rotten@windfish.net
  Subject: Re: BUG #14290: materialized view refresh doesn't use temp_tablespace
  In-Reply-To: <87shtu9ewv.fsf@news-spur.riddles.org.uk>
  References: <20160818190623.1529.12440@wrigleys.postgresql.org> <87shtu9ewv.fsf@news-spur.riddles.org.uk>

* 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