Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id DCA329F960F for ; Mon, 10 Sep 2007 19:45:58 -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 36242-09 for ; Mon, 10 Sep 2007 19:45:52 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from exprod6og51.obsmtp.com (exprod6og51.obsmtp.com [64.18.1.183]) by postgresql.org (Postfix) with SMTP id 5AFFE9F9629 for ; Mon, 10 Sep 2007 19:45:57 -0300 (ADT) Received: from source ([63.240.6.46]) (using TLSv1) by exprod6ob51.postini.com ([64.18.5.12]) with SMTP; Mon, 10 Sep 2007 15:45:54 PDT Received: from 172.16.1.114 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Mon, 10 Sep 2007 18:46:20 -0400 X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 Received: from MI8NYCMAIL08.Mi8.com ([172.16.1.165]) by d01smtp07.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 10 Sep 2007 18:46:20 -0400 Received: from 63.80.24.130 ([63.80.24.130]) by MI8NYCMAIL08.Mi8.com ( [172.16.1.190]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.134]) with Microsoft Exchange Server HTTP-DAV ; Mon, 10 Sep 2007 22:46:13 +0000 User-Agent: Microsoft-Entourage/11.3.6.070618 Date: Mon, 10 Sep 2007 15:45:26 -0700 Subject: Re: random_page_costs - are defaults of 4.0 realistic for SCSI RAID 1 From: "Luke Lonergan" To: "Mark Mielke" , "Gregory Stark" cc: "Carlo Stonebanks" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] random_page_costs - are defaults of 4.0 realistic for SCSI RAID 1 Thread-Index: Acfz/Ed8hecSYV/vEdyZDgAbY5GgAQ== In-Reply-To: <46E5C05A.7010800@mark.mielke.cc> MIME-Version: 1.0 X-OriginalArrivalTime: 10 Sep 2007 22:46:20.0383 (UTC) FILETIME=[67E6B6F0:01C7F3FC] X-WSS-ID: 6AFB16B64K02949808-03-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/167 X-Sequence-Number: 26712 Hi Mark, Greg, On 9/10/07 3:08 PM, "Mark Mielke" wrote: > One suggestion: The plan is already in a tree. With some dependency analysis, > I assume the tree could be executed in parallel (multiple threads or event > triggered entry into a state machine), and I/O to fetch index pages or table > pages could be scheduled in parallel. At this point, AIO becomes necessary to > let the underlying system (and hardware with tagged queueing?) schedule which > pages should be served best first. Right now the pattern for index scan goes like this: - Find qualifying TID in index - Seek to TID location in relfile - Acquire tuple from relfile, return When the tuples are widely distributed in the table, as is the case with a very selective predicate against an evenly distributed attribute on a relation 2x larger than the I/O cache + bufcache, this pattern will result in effectively "random I/O". In actual fact, the use of the in-memory bitmap index will make the I/Os sequential, but sparse, which is another version of "random" if the sequential I/Os are larger than the gather/scatter I/O aggregation in the OS scheduler (say 1MB). This is a very common circumstance for DSS / OLAP / DW workloads. For plans that qualify with the above conditions, the executor will issue blocking calls to lseek(), which will translate to a single disk actuator moving to the needed location in seek_time, approximately 8ms. The seek_time for a single query will not improve with the increase in number of disks in an underlying RAID pool, so we can do about 1000/8 = 125 seeks per second no matter what I/O subsystem we have. If we implement AIO and allow for multiple pending I/Os used to prefetch groups of qualifying tuples, basically a form of random readahead, we can improve the throughput for any given query by taking advantage of multiple disk actuators. This will work for RAID5, RAID10 and other disk pooling mechanisms because the lseek() will be issued as parallel events. Note that the same approach would also work to speed sequential access by overlapping compute and I/O. - Luke