Re: Index build temp files

Stephen Frost <sfrost@snowman.net>

From: Stephen Frost <sfrost@snowman.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Simon Riggs <simon@2ndQuadrant.com>, Bruce Momjian <bruce@momjian.us>, pgsql-hackers@postgresql.org
Date: 2013-01-09T02:25:48Z
Lists: pgsql-hackers
* Tom Lane (tgl@sss.pgh.pa.us) wrote:
> Simon Riggs <simon@2ndQuadrant.com> writes:
> > On 9 January 2013 00:04, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >> I don't think it's a bug.  What you seem to be proposing is that CREATE
> >> INDEX ought to ignore temp_tablespaces and instead always put its temp
> >> files in the tablespace where the finished index will reside.
> 
> > I don't think that's what he said.
> 
> Then I misunderstood.  Stephen, what was your thought exactly about
> what should happen?

Perhaps this is more of a bug than I originally thought, given the
confusion and general expectation.

Here's what we're seeing:

postgresql.conf:
temp_tablespaces = 'temp_01,temp_02'

I have temp file logging on in postgresql.conf, so here's what we see:

LOG:  temporary file: path "base/pgsql_tmp/pgsql_tmp9221.4", size 204521472
CONTEXT:  SQL statement "create index table_key_idx on table (key) tablespace data_n04"

We observe the files being created under $DATA/base/pgsql_tmp/, ignoring
the temp tablespaces and not using the tablespace where the index is
ultimately created either.  I was speculating earlier that it should use
one or the other.  I'd be perfectly happy if it used one of the temp
tablespaces, but currently it's using pg_default regardless of the other
settings.

	Thanks,

		Stephen