X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 30B939DCB63 for ; Fri, 23 Dec 2005 00:28:40 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32323-07 for ; Fri, 23 Dec 2005 00:28:38 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id BF2389DC9F0 for ; Fri, 23 Dec 2005 00:28:37 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jBN4SUGa015781; Thu, 22 Dec 2005 23:28:30 -0500 (EST) To: "Qingqing Zhou" cc: pgsql-admin@postgresql.org, "Dan Austin" Subject: Re: Pgstat.tmp file activity In-reply-to: References: Comments: In-reply-to "Qingqing Zhou" message dated "Thu, 22 Dec 2005 20:24:17 -0500" Date: Thu, 22 Dec 2005 23:28:30 -0500 Message-ID: <15780.1135312110@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.037 required=5 tests=[AWL=0.037] X-Spam-Score: 0.037 X-Spam-Level: X-Archive-Number: 200512/289 X-Sequence-Number: 20009 "Qingqing Zhou" writes: > ""Dan Austin"" 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