I am running this code on Windows 2003. It
appears that postgres has in src/port/dirent.c
a port of readdir() that internally uses the
WIN32_FIND_DATA structure, and the function
FindNextFile() to iterate through the directory.
Looking at the documentation, it seems that
this function does collect file creation time,
last access time, last write time, file size, etc.,
much like performing a stat.
In my case, the code is iterating through roughly
56,000 files. Apparently, this is doing the
equivalent of a stat on each of
From: Tom Lane <tgl@xxxxxxxxxxxxx>
To: Mark Dilger <markdilger@xxxxxxxxx>
Cc: deepak <deepak.pn@xxxxxxxxx>; Alban Hertroys <haramrae@xxxxxxxxx>; "pgsql-general@xxxxxxxxxxxxxx" <pgsql-general@xxxxxxxxxxxxxx>
Sent: Wednesday, May 23, 2012 1:54 PM
FATAL: lock file "postmaster.pid" already exists
Mark Dilger <markdilger@xxxxxxxxx
> We only use one database, not counting the
> built-in template databases. The server is
> running 9.1.3. We were running 9.1.1 until
> fairly recently.
OK. I had forgotten that in recent versions, RemovePgTempFiles doesn't
only iterate through the pgsql_tmp directories; it scans the regular
database directories too, looking for possibly orphaned temp relations.
So if you had lots and lots of files in your regular database
directories, possibly scanning those could be slow. Still, it's only
looking at the file names, not attempting to stat() them or anything,
so it would be a pretty shoddy filesystem that would take a really long
time for that.
regards, tom lane