I have a nagios check on ancient tempfiles, intended to catch debris left by crashed processes. But triggered on this file:
$ sudo find /var/lib/pgsql/12/data/base/pgsql_tmp -ls 142977 4 drwxr-x--- 3 postgres postgres 4096 Dec 12 11:32 /var/lib/pgsql/12/data/base/pgsql_tmp 169868 4 drwxr-x--- 2 postgres postgres 4096 Dec 7 01:35 /var/lib/pgsql/12/data/base/pgsql_tmp/pgsql_tmp11025.0.sharedfileset 169347 5492 -rw-r----- 1 postgres postgres 5619712 Dec 7 01:35 /var/lib/pgsql/12/data/base/pgsql_tmp/pgsql_tmp11025.0.sharedfileset/0.0 169346 5380 -rw-r----- 1 postgres postgres 5505024 Dec 7 01:35 /var/lib/pgsql/12/data/base/pgsql_tmp/pgsql_tmp11025.0.sharedfileset/1.0 I found: 2019-12-07 01:35:56 | 11025 | postgres | canceling statement due to statement timeout | CLUSTER pg_stat_database_snap USI 2019-12-07 01:35:56 | 11025 | postgres | temporary file: path "base/pgsql_tmp/pgsql_tmp11025.0.sharedfileset/2.0", size 5455872 | CLUSTER pg_stat_database_snap USI I don't have a saved log entry for sharedfileset/0.0 - that may be significant, or may be a bug in my log-archiving script. The process has not crashed since it started: postgres 18145 1 0 Nov18 ? 00:51:39 /usr/pgsql-12/bin/postmaster -D /var/lib/pgsql/12/data postgres 18147 18145 0 Nov18 ? 00:00:53 postgres: logger postgres 18149 18145 0 Nov18 ? 00:38:42 postgres: checkpointer version | PostgreSQL 12.1 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39), 64-bit Just to be sure: $ ps -wwf 11025 || echo not running UID PID PPID C STIME TTY STAT TIME CMD not running I wasn't able to reproduce it like this. PGOPTIONS='-c maintenance_work_mem=128MB -c client_min_messages=debug' psql postgres -c 'CREATE TABLE t (i int unique); INSERT INTO t SELECT generate_series(1,999999)' -c 'SET statement_timeout=4999' -c 'CLUSTER t USING t_i_key' Actually, I tried using pg_ls_tmpdir(), but it unconditionally masks non-regular files and thus shared filesets. Maybe that's worth discussion on a new thread ? src/backend/utils/adt/genfile.c /* Ignore anything but regular files */ if (!S_ISREG(attrib.st_mode)) continue; BTW there's no other tablespaces. Justin