Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id C992D1337B6C for ; Tue, 12 Oct 2010 13:38:30 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 03971-06 for ; Tue, 12 Oct 2010 16:38:22 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from shrek.krogh.cc (2605ds1-ynoe.0.fullrate.dk [90.184.12.24]) by mail.postgresql.org (Postfix) with ESMTP id 0A4391337B55 for ; Tue, 12 Oct 2010 13:38:21 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by shrek.krogh.cc (Postfix) with ESMTP id B31BDC5295; Tue, 12 Oct 2010 18:38:19 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at shrek.krogh.cc Received: from shrek.krogh.cc ([127.0.0.1]) by localhost (shrek.krogh.cc [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Y1io4K9wMNfN; Tue, 12 Oct 2010 18:38:13 +0200 (CEST) Received: from [90.184.13.151] (2605ds1-ynoe.2.fullrate.dk [90.184.13.151]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: jesper@krogh.cc) by shrek.krogh.cc (Postfix) with ESMTPSA id 77DF2C5290; Tue, 12 Oct 2010 18:38:13 +0200 (CEST) Message-ID: <4CB48EF4.5030502@krogh.cc> Date: Tue, 12 Oct 2010 18:38:12 +0200 From: Jesper Krogh User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 MIME-Version: 1.0 To: Scott Carey CC: Samuel Gendler , Greg Smith , Joshua Tolley , Craig Ringer , "mladen.gogala@vmsinfo.com" , Neil Whelchel , "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> In-Reply-To: <0CA660FA-F59C-494E-BFA9-98CE8E527378@richrelevance.com> Content-Type: multipart/alternative; boundary="------------080709050900060204090305" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-10 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201010/164 X-Sequence-Number: 40583 This is a multi-part message in MIME format. --------------080709050900060204090305 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 2010-10-12 18:02, Scott Carey wrote: > However, for large reporting queries and sequential scans, XFS will > win in the long run if you use the online defragmenter. Otherwise, > your sequential scans won't be all that sequential on any file system > over time if your tables aren't written once, forever, serially. > Parallel restore will result in a system that is fragmented -- ext4 > will do best at limiting this on the restore, but only xfs has online > defragmentation. We schedule ours daily and it noticeably improves > sequential scan I/O. > > Supposedly, an online defragmenter is in the works for ext4 but it > may be years before its available. 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)); So if you have a relations filling 10GB allready, they the next "file" for the relations is just fully allocated on the first byte by the filesystem. That would ensure that large table is sitting efficiently on the filesystem level with a minimum of fragmentation on ext4(and other FS's supporting posix_fallocate) and for small systems it would only fill 10% more of diskspace... .. .. last night I spend an hour looking for where its done but couldnt find the source-file where extention of an existing relation takes place.. can someone give directions? -- Jesper --------------080709050900060204090305 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 2010-10-12 18:02, Scott Carey wrote:
> However, for large reporting queries and sequential scans, XFS will
> win in the long run if you use the online defragmenter.  Otherwise,
> your sequential scans won't be all that sequential on any file system
> over time if your tables aren't written once, forever, serially.
> Parallel restore will result in a system that is fragmented -- ext4
> will do best at limiting this on the restore, but only xfs has online
> defragmentation.  We schedule ours daily and it noticeably improves
> sequential scan I/O.
>
> Supposedly, an online defragmenter is in the works for ext4 but it
> may be years before its available.

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));

So if you have a relations filling 10GB allready, they the next "file" for the
relations is just fully allocated on the first byte by the filesystem. That
would ensure that large table is sitting efficiently on the filesystem level with
a minimum of fragmentation on ext4(and other FS's supporting posix_fallocate)
and for small systems it would only fill 10% more of diskspace...   ..

.. last night I spend an hour looking for where its done but couldnt find the
source-file where extention of an existing relation takes place.. can
someone give directions?

--
Jesper




--------------080709050900060204090305--