Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 38D101337B4B for ; Wed, 13 Oct 2010 08:42:22 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 90091-08 for ; Wed, 13 Oct 2010 11:42:14 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by mail.postgresql.org (Postfix) with ESMTP id 8E87F1335B36 for ; Wed, 13 Oct 2010 08:42:12 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id DCC04AE7DD for ; Wed, 13 Oct 2010 19:42:10 +0800 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (mail.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id chT3vs8nxQQp for ; Wed, 13 Oct 2010 19:42:05 +0800 (WST) Received: from [10.1.1.8] (124-148-209-200.dyn.iinet.net.au [124.148.209.200]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTPSA id A267FAE72A for ; Wed, 13 Oct 2010 19:42:04 +0800 (WST) Message-ID: <4CB59B08.6030900@postnewspapers.com.au> Date: Wed, 13 Oct 2010 19:42:00 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.12) Gecko/20100914 Thunderbird/3.0.8 MIME-Version: 1.0 To: "pgsql-performance@postgresql.org" Subject: Re: Slow count(*) again... References: <201010091626.18636.neil.whelchel@gmail.com> <4CB11CC7.8070300@vmsinfo.com> <4CB167CA.9070109@postnewspapers.com.au> <4CB1F46E.80205@vmsinfo.com> <4CB2410C.6010603@postnewspapers.com.au> <4cb25a0e.2a978e0a.7797.33d6@mx.google.com> <4CB3C598.2010302@2ndquadrant.com> <0CA660FA-F59C-494E-BFA9-98CE8E527378@richrelevance.com> <4CB48EF4.5030502@krogh.cc> In-Reply-To: <4CB48EF4.5030502@krogh.cc> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201010/205 X-Sequence-Number: 40624 On 13/10/2010 12:38 AM, Jesper Krogh wrote: > If some clever postgres hacker could teach postgres to allocate blocks > using posix_fallocate in quite large batches, say .. something like: > fallocate(min(current_relation_size *0.1,1073741824)) There doesn't seem to be any use of posix_fallocate in the sources, at least according to git grep. The patch that introduced posix_fadvise use apparently had posix_fallocate in it, but that use appears to have been removed down the track. It's worth noting that posix_fallocate sucks if your file system doesn't intelligent support for it. IIRC it's horrible on ext3, where it can take a while to return while it allocates (and IIRC zeroes!) all those blocks. This may be part of why it's not used. In past testing with posix_fallocate for other tools I've also found rather mixed performance results - it can slow things down rather than speed them up, depending on the file system in use and all sorts of other factors. If Pg was to use posix_fallocate, it'd probably need control over it on a per-tablespace basis. -- Craig Ringer Tech-related writing at http://soapyfrogs.blogspot.com/