Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 4E1469FA2B2 for ; Wed, 18 Jul 2007 04:36:59 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 32636-02 for ; Wed, 18 Jul 2007 04:36:53 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from smtp.vodafone.nl (smtp-out.vizzavi.nl [195.232.199.126]) by postgresql.org (Postfix) with ESMTP id 6C2A79FA297 for ; Wed, 18 Jul 2007 04:36:55 -0300 (ADT) Received: from conversion-daemon.vfnlw44s.vfnl.dc-ratingen.de by vfnlw44s.vfnl.dc-ratingen.de (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) id <0JLD00D015WFV600@vfnlw44s.vfnl.dc-ratingen.de> (original mail from postgres@microbizz.nl) for pgsql-performance@postgresql.org; Wed, 18 Jul 2007 09:36:53 +0200 (MEST) Received: from [212.56.242.41] by vfnlw44s.vfnl.dc-ratingen.de (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JLD00D3N6HB1IA0@vfnlw44s.vfnl.dc-ratingen.de> for pgsql-performance@postgresql.org; Wed, 18 Jul 2007 09:36:52 +0200 (MEST) Date: Wed, 18 Jul 2007 09:36:45 +0200 From: Adriaan van Os Subject: Re: TRUNCATE TABLE In-reply-to: <25418.1184631498@sss.pgh.pa.us> To: pgsql-performance@postgresql.org Message-id: <469DC30D.3060603@microbizz.nl> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7BIT References: <46953949.3030201@microbizz.nl> <87ps2ypox3.fsf@oxford.xeocode.com> <46972DFA.9000900@microbizz.nl> <20070713124435.GL31358@mathom.us> <21495.1184337630@sss.pgh.pa.us> <4697A58E.8060904@microbizz.nl> <23092.1184344246@sss.pgh.pa.us> <20070713173501.GD12109@alvh.no-ip.org> <162867790707131212g17cbc5a9q5d098dbf01c8e502@mail.gmail.com> <20070716213944.GA39272@nasby.net> <25418.1184631498@sss.pgh.pa.us> User-Agent: Thunderbird 1.5.0.4 (Macintosh/20060516) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/206 X-Sequence-Number: 25890 Tom Lane wrote: > Thus the timing issue (at least as exhibited by this script) has nothing > whatever to do with the time to delete a file, but with the time to > create one. Since the part of DROP being timed has probably got no I/O > involved at all (the tuples being touched are almost surely still in > shared buffers), it's unsurprising that it is consistently fast. In my original profiling, CREATE TEMPORARY TABLE/DROP TABLE wasn't much faster than TRUNCATE TABLE. When I try it again now, I see that DROP TABLE is consistently fast, while the timings of CREATE TEMPORARY TABLE vary as much as those of TRUNCATE TABLE. Your observations on the time needed to open a file confirm that, I think. In my test databases, autovacuum is off. Regards, Adriaan van Os