I have tons of old files with names like base/db/pg_sorttemp####.##.  I
 assume that they are temporary sorting files but somehow they never got
cleared out.  Is it safe to delete these from a running system.  The files
are months old.

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.

Wed, 17 Oct 2001 15:46:17 -0400 (EDT)
darcy@druid.net (D'Arcy J.M. Cain)
pg_sorttemp files
My guess is probably yes it's ok - just shut down the server before deleting
them!

Chris

> -----Original Message-----
> From: pgsql-hackers-owner@postgresql.org
> [mailto:pgsql-hackers-owner@postgresql.org]On Behalf Of D'Arcy J.M. Cain
> Sent: Thursday, 18 October 2001 3:46 AM
> To: pgsql-hackers@postgresql.org
> Subject: [HACKERS] pg_sorttemp files
>
>
> I have tons of old files with names like base/db/pg_sorttemp####.##.  I
>  assume that they are temporary sorting files but somehow they never got
> cleared out.  Is it safe to delete these from a running system.  The files
> are months old.
>
> --
> D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
> http://www.druid.net/darcy/                |  and a sheep voting on
> +1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>


Thu, 18 Oct 2001 09:52:21 +0800
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au>
Re: pg_sorttemp files
darcy@druid.net (D'Arcy J.M. Cain) writes:
> I have tons of old files with names like base/db/pg_sorttemp####.##.  I
>  assume that they are temporary sorting files but somehow they never got
> cleared out.  Is it safe to delete these from a running system.  The files
> are months old.

The first #### is the PID of the backend that made them.  If there is no
such backend anymore according to ps, it's safe to zap 'em.  I'd rely on
that much more than the mod date.

BTW, if you are seeing unreclaimed sorttemp files in a recent release
(7.0 or later), I'd like to know about it.  That shouldn't happen,
short of a backend crash anyway...

			regards, tom lane

Thu, 18 Oct 2001 13:45:49 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: pg_sorttemp files 
Thus spake Tom Lane
> darcy@druid.net (D'Arcy J.M. Cain) writes:
> > I have tons of old files with names like base/db/pg_sorttemp####.##.  I
> >  assume that they are temporary sorting files but somehow they never got
> > cleared out.  Is it safe to delete these from a running system.  The files
> > are months old.
> 
> The first #### is the PID of the backend that made them.  If there is no
> such backend anymore according to ps, it's safe to zap 'em.  I'd rely on
> that much more than the mod date.

Thanks.  I wasn't sure about that PID thing but I have now run a script
that got rid of them all.

> BTW, if you are seeing unreclaimed sorttemp files in a recent release
> (7.0 or later), I'd like to know about it.  That shouldn't happen,
> short of a backend crash anyway...

Well, I had over 6,000 of these files.  This database is about a year old.
I haven't seen all that many backend crashes in that time.  I guess I better
keep a close eye on them.

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.

Fri, 19 Oct 2001 07:52:05 -0400 (EDT)
darcy@druid.net (D'Arcy J.M. Cain)
Re: pg_sorttemp files
darcy@druid.net (D'Arcy J.M. Cain) writes:
>> BTW, if you are seeing unreclaimed sorttemp files in a recent release
>> (7.0 or later), I'd like to know about it.  That shouldn't happen,
>> short of a backend crash anyway...

> Well, I had over 6,000 of these files.  This database is about a year old.
> I haven't seen all that many backend crashes in that time.  I guess I better
> keep a close eye on them.

Wow!  Did you happen to note how many distinct PIDs were accounted for?
That would give us some idea of how many lossage events there were.

			regards, tom lane

Fri, 19 Oct 2001 10:09:26 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: pg_sorttemp files 
Thus spake Tom Lane
> darcy@druid.net (D'Arcy J.M. Cain) writes:
> >> BTW, if you are seeing unreclaimed sorttemp files in a recent release
> >> (7.0 or later), I'd like to know about it.  That shouldn't happen,
> >> short of a backend crash anyway...
> 
> > Well, I had over 6,000 of these files.  This database is about a year old.
> > I haven't seen all that many backend crashes in that time.  I guess I better
> > keep a close eye on them.
> 
> Wow!  Did you happen to note how many distinct PIDs were accounted for?
> That would give us some idea of how many lossage events there were.

I think there were about 25 or so.

Perhaps these files could be cleaned up on startup.

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.

Sat, 20 Oct 2001 07:44:20 -0400 (EDT)
darcy@druid.net (D'Arcy J.M. Cain)
Re: pg_sorttemp files
> Thus spake Tom Lane
> > darcy@druid.net (D'Arcy J.M. Cain) writes:
> > >> BTW, if you are seeing unreclaimed sorttemp files in a recent release
> > >> (7.0 or later), I'd like to know about it.  That shouldn't happen,
> > >> short of a backend crash anyway...
> > 
> > > Well, I had over 6,000 of these files.  This database is about a year old.
> > > I haven't seen all that many backend crashes in that time.  I guess I better
> > > keep a close eye on them.
> > 
> > Wow!  Did you happen to note how many distinct PIDs were accounted for?
> > That would give us some idea of how many lossage events there were.
> 
> I think there were about 25 or so.
> 
> Perhaps these files could be cleaned up on startup.

The will be cleaned up on postmaster startup in 7.2.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Sat, 20 Oct 2001 12:38:06 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: pg_sorttemp files