Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 3CB826321E9 for ; Sun, 14 Mar 2010 13:31:41 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 98452-06 for ; Sun, 14 Mar 2010 16:31:29 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-fx0-f222.google.com (mail-fx0-f222.google.com [209.85.220.222]) by mail.postgresql.org (Postfix) with ESMTP id 5D54F636012 for ; Sun, 14 Mar 2010 13:31:30 -0300 (ADT) Received: by fxm22 with SMTP id 22so2771567fxm.34 for ; Sun, 14 Mar 2010 09:31:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:received:date:from:to:cc :subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=dwYryGAPhkzC4+JfaHCsAntKut/OCpbdgR0FUTHZ3LY=; b=pQJ9Wqp6MRRtpFwnc0+CJY2denLUbi0/SD+tDzSJDWy2QoUbZm6WBbBUJzhrH3/VkU VfJjeB7H9CqBo2TxsXRfEqjch4LqDE5/xaAGm8SbOc7wICNYGvYTmr2HXwGOsCu/B/o7 3p7/ineFfrRJyykFScCW9aPRoGqRfCL5dkVNA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=jddvIlRza3weQtzjEZCIWS/jK8VFNPnXxbC9GVXJb62BFo3xLJhOGDqDJoSGl434Ta O0ttyurDbMDdKquchaccsmm98JqbM2PRdMQ7bMAteRLuV9CpSsLMvCUmfpyvUL1j+IXZ jASCjTCHpxXB6pW7zN5DDUT+uDtskTlrPdgc0= Received: by 10.223.15.133 with SMTP id k5mr813512faa.39.1268584289228; Sun, 14 Mar 2010 09:31:29 -0700 (PDT) Received: from googlemail.com (port-87-193-148-114.static.qsc.de [87.193.148.114]) by mx.google.com with ESMTPS id 16sm2495488fxm.15.2010.03.14.09.31.27 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 14 Mar 2010 09:31:28 -0700 (PDT) Received: by googlemail.com (nbSMTP-1.00) for uid 1100 (using TLSv1/SSLv3 with cipher RC4-MD5 (128/128 bits)) fkater@googlemail.com; Sun, 14 Mar 2010 17:31:06 +0100 (CET) Date: Sun, 14 Mar 2010 17:31:05 +0100 From: "fkater@googlemail.com" To: Dave Crooke Cc: pgsql-performance@postgresql.org Subject: Re: Deleting bytea, autovacuum, and 8.2/8.4 differences Message-ID: <20100314163105.GB2153@comppasch2> References: <20100313211742.GC2178@comppasch2> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=AWL=0.000, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201003/134 X-Sequence-Number: 37959 Hi Dave, thank you for your answers! Here some comments: Dave Crooke: > > * The table just has 5 unused int columns, a timestamp, > > OIDs, and the bytea column, *no indices*; the bytea storage > > type is 'extended', the 16 MB are compressed to approx. the > > half. > > > > Why no indices? Simply because the test case had just < 50 rows (deleting all rows older than 2 minues). Later on I would use indices. > > while it is planned to have the interval set to 6 hours in > > the final version (thus creating a FIFO buffer for the > > latest 6 hours of inserted data; so the FIFO will keep > > approx. 10.000 rows spanning 160-200 GB data). > > > > That's not the way to keep a 6 hour rolling buffer ... what you need to do > is run the delete frequently, with *interval '6 hours'* in the SQL acting > as the cutoff. In fact the delete was run frequently to cut everything older than 6 hours *immediately*. > If you really do want to drop the entire table contents before refilling it, > do a *DROP TABLE* and recreate it. No, I do not want to drop the whole table. > > * This deletion SQL command was simply repeatedly executed > > by pgAdmin while my app kept adding the 16 MB rows. > > > > Are you sure you are timing the delete, and not pgAdmin re-populating some > kind of buffer? Quite sure, yes. Because I launched just the delete command in pgAdmin while the rest was executed by my application outside pgAdmin, of course. > > * Autovacuum is on; I believe I need to keep it on, > > otherwise I do not free the disk space, right? If I switch > > it off, the deletion time reduces from the average 10s down > > to 4s. > > > > You may be running autovaccum too aggressively, it may be interfering with > I/O to the tables. Hm, so would should I change then? I wonder if it helps to run autovacuum less aggressive if there will not be a situation were the whole process is stopped for a while. But I'd like to understand what to change here. > 8.4 has a lot of performance improvements. It's definitely worth a shot. I'd > also consider switching to another OS where you can use a 64-bit version of > PG and a much bigger buffer cache. O.k., I'll give it a try. Thank You. Felix