Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 1F2541337B8C for ; Fri, 4 Feb 2011 05:20:38 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 97789-05 for ; Fri, 4 Feb 2011 09:20:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-fx0-f46.google.com (mail-fx0-f46.google.com [209.85.161.46]) by mail.postgresql.org (Postfix) with ESMTP id 39DBD1337B83 for ; Fri, 4 Feb 2011 05:20:29 -0400 (AST) Received: by fxm20 with SMTP id 20so2173516fxm.19 for ; Fri, 04 Feb 2011 01:20:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=rxK+OGE/mHjLqME8qsynMv3/3eofLadT8Cd8gRPxB+c=; b=hLeXfKoCc9kNUmvy02DHeOjTdPams/xOtkghLsLW+zTMi6PshxeU+MuH15s1qKg6Q7 TR+aEn7Yr29PoW5jrEI3ceXPcjexw9IeXAcNZBeFR6fBkyCmrUBGMj4mHLfEIrEoVkwF chZ3BfXhLuPTxqM7QWgtyRQlYXYvy89Mli8Ag= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=hxrsVKf5IiLXadHneRX7FBCdkDpgUFz/VYOXvgUnOsAgmj6pfnaZ+RGYAFbyOrEvlX 7lb/wstLUFwQZrlO+OUhbzxot4BGdSC37jGGrsuM9kWV3JTZpIg/3jPzQb6Wd3aUB/lB +rDdFT/mqRtndBSwjCzvNfwxrUKJwt/x57wm8= Received: by 10.223.96.198 with SMTP id i6mr5442443fan.10.1296811229687; Fri, 04 Feb 2011 01:20:29 -0800 (PST) Received: from [10.1.1.57] (skuns.zoral.com.ua [91.193.166.194]) by mx.google.com with ESMTPS id n2sm125400fam.4.2011.02.04.01.20.26 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 04 Feb 2011 01:20:27 -0800 (PST) Message-ID: <4D4BC491.7080908@gmail.com> Date: Fri, 04 Feb 2011 11:19:13 +0200 From: Vitalii Tymchyshyn User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 MIME-Version: 1.0 To: Robert Haas CC: Scott Carey , Stephen Frost , Scott Marlowe , Robert Schnabel , "david@lang.hm" , pgsql-performance Subject: Re: How to best use 32 15k.7 300GB drives? References: <20110128172810.GE30352@tamriel.snowman.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.046 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_ENVFROM_END_DIGIT=1.553, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7 X-Spam-Level: X-Archive-Number: 201102/176 X-Sequence-Number: 42314 03.02.11 20:42, Robert Haas написав(ла): > 2011/1/30 Віталій Тимчишин: >> I was thinking if a table file could be deleted if it has no single live >> row. And if this could be done by vacuum. In this case vacuum on table that >> was fully updated recently could be almost as good as cluster - any scan >> would skip such non-existing files really fast. Also almost no disk space >> would be wasted. > VACUUM actually already does something along these lines. If there > are 1 or any larger number of entirely-free pages at the end of a > table, VACUUM will truncate them away. In the degenerate case where > ALL pages are entirely-free, this results in zeroing out the file. > > The problem with this is that it rarely does much. Consider a table > with 1,000,000 pages, 50% of which contain live rows. On average, how > many pages will this algorithm truncate away? Answer: if the pages > containing live rows are randomly distributed, approximately one. Yes, but take into account operations on a (by different reasons) clustered tables, like removing archived data (yes I know, this is best done with partitioning, but one must still go to a point when he will decide to use partitioning :) ). > Your idea of having a set of heaps rather than a single heap is an > interesting one, but it's pretty much catering to the very specific > case of a full-table update. I think the code changes needed would be > far too invasive to seriously contemplate doing it just for that one > case - although it is an important case that I would like to see us > improve. Why do you expect such a invasive code changes? I know little about postgresql code layering, but what I propose (with changing delete to truncate) is: 1) Leave tuple addressing as it is now 2) Allow truncated files, treating non-existing part as if it contained not used tuples 3) Make vacuum truncate file if it has not used tuples at the end. The only (relatively) tricky thing I can see is synchronizing truncation with parallel ongoing scan. Best regards, Vitalii Tymchyshyn