From: Tom Lane <tgl@sss.pgh.pa.us>
To: Qingqing Zhou <zhouqq@cs.toronto.edu>
Cc: pgsql-admin@postgresql.org, "Dan Austin" <DAustin@au.westfield.com>
Subject: Re: Pgstat.tmp file activity
Date: Thu, 22 Dec 2005 23:28:30 -0500
Message-ID: <15780.1135312110@sss.pgh.pa.us> (raw)
In-Reply-To: <dofjhs$2pqd$1@news.hub.org>
References: <ED242F3A9037824A952B71B480A5D7ED6DFAB9@ausyd-exmb01.au.ad.westfield.com>
<dofjhs$2pqd$1@news.hub.org>
"Qingqing Zhou" <zhouqq@cs.toronto.edu> writes:
> ""Dan Austin"" <DAustin@au.westfield.com> wrote
>> I take it that the file gets renamed almost immediately because we can
>> also see writes to the parent directory -- but never see the file itself
>> using ls.
>>
> I think so.
Right, the file is fully written under a temp name, and then rename()'d
into place as pgstat.stat. rename is atomic per the Unix specs, so this
ensures that any backend looking at pgstat.stat will see a complete
consistent file. (This works on Unix anyway ... I'm not convinced that
it does on Windows ...)
But I still doubt that that's the source of your performance problem.
Earlier today I tried a 200-client pgbench run with all stats options
enabled, and I couldn't see that the stats collector was eating any
undue share of time ...
>> /export/data/pgsql/data/base/64920741/pgsql_tmp/pgsql_tmp966.9
>>
>> What are these files used for? In this particular sample, that file was
>> being written to a lot. Perhaps we're running out of memory for some
>> sorting?
> These files could be generated by several situations to store intermediate
> data. For example, hash join and external sort. For sort, if you increase
> sort_mem, then you may avoid/alleviate usage of temp file.
AFAIR, increasing work_mem (nee sort_mem) will affect all the sources of
temp-file usage, not only sorts. You want to be careful not to push it
up so far that your system starts swapping --- see past discussions in
the pgsql-performance archives.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, zhouqq@cs.toronto.edu, DAustin@au.westfield.com
Subject: Re: Pgstat.tmp file activity
In-Reply-To: <15780.1135312110@sss.pgh.pa.us>
References: <ED242F3A9037824A952B71B480A5D7ED6DFAB9@ausyd-exmb01.au.ad.westfield.com> <dofjhs$2pqd$1@news.hub.org> <15780.1135312110@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox