>>>>> "Kevin" == Kevin Grittner <kgrittn@gmail.com> writes:
Kevin> You are confusing two completely different things: temporary
Kevin> objects (created by statements starting with CREATE TEMPORARY)
Kevin> and temporary files (created when data spills to disk during,
Kevin> for example, a sort, hash, or materialization of data internal
Kevin> to processing some statement). The former are placed based on
Kevin> temp_tablespaces; the latter are normally placed in the
Kevin> base/pgsql_tmp/ subdirectory.
This is not true.
If temp_tablespaces is set, then all sort / hash / materialization files
will use the list of tablespaces in temp_tablespaces on a rotational
basis (to spread load). The only exception is for temp files that might
have to outlive the current transaction; these are forced into the
default tablespace of the current database. See storage/file/fd.c
However, materialized view refresh (without CONCURRENTLY) needs the new
copy of the matview's data to be in the same tablespace as the old copy,
since it moves the data into place via a heap swap. This restriction
does not apply to sort/hash/materialization files created by the
matview's query.
--
Andrew (irc:RhodiumToad)