X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E9F54537AD for ; Fri, 15 Apr 2005 15:01:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06786-01 for ; Fri, 15 Apr 2005 18:01:50 +0000 (GMT) Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id 062B6537A7 for ; Fri, 15 Apr 2005 15:01:49 -0300 (ADT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1DMV8P-0004S7-00; Fri, 15 Apr 2005 14:01:41 -0400 To: Tom Lane Cc: Kevin Brown , pgsql-performance@postgresql.org Subject: Re: How to improve db performance with $7K? References: <33c6269f050406151241b01148@mail.gmail.com> <20050406224102.GM93835@decibel.org> <33c6269f0504061732195f6ae4@mail.gmail.com> <87wtrfmgt5.fsf@stark.xeocode.com> <13449.1112847297@sss.pgh.pa.us> <20050414055655.GB19518@filer> <878y3lj23o.fsf@stark.xeocode.com> <20050414083608.GC19518@filer> <446.1113489854@sss.pgh.pa.us> <20050415020337.GD19518@filer> <28523.1113532916@sss.pgh.pa.us> In-Reply-To: <28523.1113532916@sss.pgh.pa.us> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 15 Apr 2005 14:01:41 -0400 Message-ID: <87sm1rdim2.fsf@stark.xeocode.com> Lines: 38 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/358 X-Sequence-Number: 11755 Tom Lane writes: > Yes, you can probably assume that blocks with far-apart numbers are > going to require a big seek, and you might even be right in supposing > that a block with an intermediate number should be read on the way. > But you have no hope at all of making the right decisions at a more > local level --- say, reading various sectors within the same cylinder > in an optimal fashion. You don't know where the track boundaries are, > so you can't schedule in a way that minimizes rotational latency. > You're best off to throw all the requests at the drive together and > let the drive sort it out. Consider for example three reads, one at the beginning of the disk, one at the very end, and one in the middle. If the three are performed in the logical order (assuming the head starts at the beginning), then the drive has to seek, say, 4ms to get to the middle and 4ms to get to the end. But if the middle block requires a full rotation to reach it from when the head arrives that adds another 8ms of rotational delay (assuming a 7200RPM drive). Whereas the drive could have seeked over to the last block, then seeked back in 8ms and gotten there just in time to perform the read for free. I'm not entirely convinced this explains all of the SCSI drives' superior performance though. The above is about a worst-case scenario. should really only have a small effect, and it's not like the drive firmware can really schedule things perfectly either. I think most of the difference is that the drive manufacturers just don't package their high end drives with ATA interfaces. So there are no 10k RPM ATA drives and no 15k RPM ATA drives. I think WD is making fast SATA drives but most of the manufacturers aren't even doing that. -- greg