Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 6BAB99FB7FA for ; Thu, 26 Apr 2007 09:10:43 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 31899-05 for ; Thu, 26 Apr 2007 09:10:33 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.236]) by postgresql.org (Postfix) with ESMTP id A55A69FB6F3 for ; Thu, 26 Apr 2007 09:10:38 -0300 (ADT) Received: by wx-out-0506.google.com with SMTP id i28so535010wxd for ; Thu, 26 Apr 2007 05:10:37 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=GkM6/JvlOwnyxSfA+8NCCG26fUo+OUSMrLoAZQ2iCFaXRYVCWzvlOTkcjpHf9e5MrMZoWdLpjmbgmaQ6upMt0fod9QC0hOIjAUK41kZLrThIFriMtFKCQlm77fB3bU/RV8t1QG3nVBJ+uLINeTPkLXvkFn3Qbv13zuIBXLoX19U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=keCD7Ncr7s1JWBrQ1NsREESltIEpOV/nBvDRTnk/bY5Y+wwd5YTIsHEDMiTxNhcH3JDDa1HzSUfafnapabG4fuBqB3Cxl89IvgD5dZgYuRqA5GqaAYXy6ds6N0UMu/CgSdE7DkTMMqh9oSCja75B7AiVpQJmeOab4lnCk3G27T8= Received: by 10.90.34.3 with SMTP id h3mr1874843agh.1177589437136; Thu, 26 Apr 2007 05:10:37 -0700 (PDT) Received: from ?172.24.32.35? ( [62.232.55.118]) by mx.google.com with ESMTP id k28sm4994173ugd.2007.04.26.05.10.33; Thu, 26 Apr 2007 05:10:34 -0700 (PDT) Message-ID: <463096AD.4020707@enterprisedb.com> Date: Thu, 26 Apr 2007 13:10:21 +0100 From: Heikki Linnakangas User-Agent: Icedove 1.5.0.10 (X11/20070329) MIME-Version: 1.0 To: Bill Moran CC: Jim Nasby , Postgresql list Performance Subject: Re: Fragmentation of WAL files References: <3BD44C5D-E402-43EB-8FFD-1A4BC97AFD0C@decibel.org> <20070426080050.522ef7b5.wmoran@collaborativefusion.com> In-Reply-To: <20070426080050.522ef7b5.wmoran@collaborativefusion.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/427 X-Sequence-Number: 24304 Bill Moran wrote: > In response to Jim Nasby : > >> I was recently running defrag on my windows/parallels VM and noticed >> a bunch of WAL files that defrag couldn't take care of, presumably >> because the database was running. What's disturbing to me is that >> these files all had ~2000 fragments. Now, this was an EnterpriseDB >> database which means the WAL files were 64MB instead of 16MB, but >> even having 500 fragments for a 16MB WAL file seems like it would >> definitely impact performance. > > I don't know about that. I've seen marketing material that claims that > modern NTFS doesn't suffer performance problems from fragmentation. I've > never tested it myself, but my point is that you might want to do some > experiments -- you might find out that it doesn't make any difference. > > If it does, you should be able to stop the DB, defragment the files, then > start the DB back up. Since WAL files are recycled, they shouldn't > fragment again -- unless I'm missing something. > > If that works, it may indicate that (on Windows) a good method for installing > is to create all the necessary WAL files as empty files before launching > the DB. If that turns out to be a problem, I wonder if it would help to expand the WAL file to full size with ftruncate or something similar, instead of growing it page by page. >> Can anyone else confirm this? I don't know if this is a windows-only >> issue, but I don't know of a way to check fragmentation in unix. > > I can confirm that it's only a Windows problem. No UNIX filesystem > that I'm aware of suffers from fragmentation. What do you mean by suffering? All filesystems fragment files at some point. When and how differs from filesystem to filesystem. And some filesystems might be smarter than others in placing the fragments. There's a tool for Linux in the e2fsprogs package called filefrag that shows the fragmentation of a file, but I've never used it myself. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com