Temporary files

There are a few situations where PostgreSQL saves temporary files, ones that are not critical to database operation. Tables created using CREATE TEMPORARY TABLE and their respective indexes are one source. Probably more importantly, when the database is doing a query that involves a sort operation, and the data exceeds work_mem, temporary files are created for that purpose. So, in situations where your users will be doing lots of sorting of large tables, as in a data warehouse, there can be quite a bit of activity going to disk for this purpose.

The temp_tablespaces database parameter allows relocation of all the temporary tables to one chosen from the list of additional tablespaces provided. If you put more than one tablespace ...

Get PostgreSQL 10 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.