A bit confused about "pgsql_tmp" vs "temp tablespace"

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема A bit confused about "pgsql_tmp" vs "temp tablespace"
Дата
Msg-id pimrhm$c41$1@blaine.gmane.org
обсуждение исходный текст
Ответы Re: A bit confused about "pgsql_tmp" vs "temp tablespace"
Список pgsql-general
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*?
 

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. 

Background: we are setting up a new server that has a regular (large) SSD and very fast NVMe SSD (which is too small to
holdall tables). 
 
So we would like to put anything that is "temporary" onto the NVMe drive. 

But I'm unsure if that is better done through a symlink for pgsql_tmp or a temp tablespace. 
Currently no temporary tables are used (but that might change in the future), so only intermediate results (e.g. CTEs,
sortingetc) would wind up there. 
 










В списке pgsql-general по дате отправления:

Предыдущее
От: "Jamison, Kirk"
Дата:
Сообщение: RE: Slow WAL recovery for DROP TABLE
Следующее
От: Hans Schou
Дата:
Сообщение: Shared buffers increased but cache hit ratio is still 85%