Thread: HUGE pg_sorttemp files, can I delete?

HUGE pg_sorttemp files, can I delete?

From
Micah Anderson
Date:
In my /var/postgres/base/database directory I've got a bunch of REALLY big
files that are from several months ago:

-rw-------    1 postgres postgres 191684608 Oct 30 23:35 pg_sorttemp10964.0
-rw-------    1 postgres postgres 192126976 Oct 30 23:44 pg_sorttemp11353.0
-rw-------    1 postgres postgres 192126976 Oct 30 23:44 pg_sorttemp11369.0
-rw-------    1 postgres postgres   983040 Oct 23 17:37 pg_sorttemp22475.0
-rw-------    1 postgres postgres 26787840 Oct 21 14:00 pg_sorttemp2372.0
-rw-------    1 postgres postgres 130465792 Nov  9 13:42 pg_sorttemp30831.0
-rw-------    1 postgres postgres 232701952 Oct 30 20:41 pg_sorttemp5564.0
-rw-------    1 postgres postgres 232701952 Oct 30 20:41 pg_sorttemp5576.0
-rw-------    1 postgres postgres 232701952 Oct 30 20:41 pg_sorttemp5588.0
-rw-------    1 postgres postgres 232792064 Oct 30 20:41 pg_sorttemp5749.0
-rw-------    1 postgres postgres 190275584 Oct 30 20:41 pg_sorttemp6480.0
-rw-------    1 postgres postgres 190275584 Oct 30 20:41 pg_sorttemp6494.0

There are some there that are from today - but from Oct 30? Can I delete
these files? What are causing these? Can I set a limit or something? My
database is 3.6 gigs, that is HUGE. I think it is largely because of these
files.

Thanks!

Micah

--
Micah Anderson
Collective Technologies
www.colltech.com

"To be and not to do is not to be at all"

Re: HUGE pg_sorttemp files, can I delete?

From
Tom Lane
Date:
Micah Anderson <micah@colltech.com> writes:
> In my /var/postgres/base/database directory I've got a bunch of REALLY big
> files that are from several months ago:

> -rw-------    1 postgres postgres 191684608 Oct 30 23:35 pg_sorttemp10964.0
> -rw-------    1 postgres postgres 192126976 Oct 30 23:44 pg_sorttemp11353.0
> -rw-------    1 postgres postgres 192126976 Oct 30 23:44 pg_sorttemp11369.0

Looks like something crashed partway through a large sort :-(

If the backend that created the temp file is no longer running, it's
certainly safe to delete the file.  The number just after "temp"
is the PID of the creating backend.

It's odd that you seem to have several identically-sized sorttemp
files from different processes at the same time.  What were you
doing on Oct 30?  Don't suppose you have a postmaster log extending
back that far?

            regards, tom lane