pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: A bit confused about "pgsql_tmp" vs "temp tablespace"
Date: Wed, 18 Jul 2018 15:57:47 +0200
Message-ID: <9bcde31d-e9c2-c391-746f-913c0403a6e4@gmx.net> (raw)
In-Reply-To: <6b47cf26-1f2d-a076-194c-dbe6c34c3c6d@aklaver.com>
References: <pimrhm$c41$1@blaine.gmane.org>
	<6b47cf26-1f2d-a076-194c-dbe6c34c3c6d@aklaver.com>

Adrian Klaver schrieb am 18.07.2018 um 15:06:
>> In the chapter "Database File layout" the pgsql_tmp is explained as follows:
>>
>>     Temporary files (for operations such as sorting more data than can fit in memory)
>>     are created within PGDATA/base/pgsql_tmp, or within a pgsql_tmp subdirectory of
>>     a tablespace directory
>>
>> However the documentation for "temp_tablespaces" states:
>>
>>     Temporary files for purposes such as sorting large data sets are also created
>>     in these tablespaces.
>>
>>
>> How do these two things related to each other?
>>
>> Does this mean that if I do not explicitly create a dedicated "temp tablespace" then the pgsql_tmp subdirectory is used.
>> But _if_ I do create a temp tablespace (by creating one, and adding it to temp_tablespaces) then the sorting is done *there*?
> 
> Yes, for those objects that do not have a tablespace specified in their CREATE statement.
>
>>
>> So far I thought that a temp tablespace is only used for temporary tables (and indexes on them) but that paragraph in the
>> temp_tablespaces documentation seems to indicate otherwise.
> 
> The Database File Layout section you quoted above says the same
> thing. Basically setting temp_tablespaces just overrides where temp
> objects and operation files are placed when a tablespace is not
> specified in their creation.

Thanks.

I understand the relation between explicitly CREATEd objects and the temp tablespace(s).

But what about the (temp) space needed for e.g. sorting, grouping or intermediate results from CTEs or derived tables? 
Is that also controlled through the temp_tablespaces? 


 




view thread (5+ messages)  latest in thread

Message-ID: <9bcde31d-e9c2-c391-746f-913c0403a6e4@gmx.net>
Permalink:  ../9bcde31d-e9c2-c391-746f-913c0403a6e4@gmx.net/
Also on:    postgresql.org/message-id/9bcde31d-e9c2-c391-746f-913c0403a6e4@gmx.net

 · 

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: spam_eater@gmx.net
  Subject: Re: A bit confused about "pgsql_tmp" vs "temp tablespace"
  In-Reply-To: <9bcde31d-e9c2-c391-746f-913c0403a6e4@gmx.net>
  References: <pimrhm$c41$1@blaine.gmane.org> <6b47cf26-1f2d-a076-194c-dbe6c34c3c6d@aklaver.com> <9bcde31d-e9c2-c391-746f-913c0403a6e4@gmx.net>

* 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