Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZXGgv-0004HG-4c for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Sep 2015 22:39:41 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZXGgt-0005Kc-Ro for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Sep 2015 22:39:39 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZXGfb-0003rt-4A for pgsql-hackers@postgresql.org; Wed, 02 Sep 2015 22:38:19 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZXGfY-0000Ql-Ni for pgsql-hackers@postgresql.org; Wed, 02 Sep 2015 22:38:17 +0000 Received: by mail.anarazel.de (Postfix, from userid 108) id E9C03860002; Thu, 3 Sep 2015 00:38:15 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail X-Spam-Level: X-Spam-Status: No, score=-5.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from anarazel.de (p54AF4FE4.dip0.t-ipconnect.de [84.175.79.228]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id D2FB2860001; Thu, 3 Sep 2015 00:38:12 +0200 (CEST) Received: by anarazel.de (Postfix, from userid 1000) id 412F4105040; Thu, 3 Sep 2015 00:38:12 +0200 (CEST) Date: Thu, 3 Sep 2015 00:38:12 +0200 From: Andres Freund To: Greg Stark Cc: Bruce Momjian , Jeff Janes , "pgsql-hackers@postgresql.org" , Merlin Moncure , Julien Rouhaud Subject: Re: Allow a per-tablespace effective_io_concurrency setting Message-ID: <20150902223812.GE8555@awork2.anarazel.de> References: <20141206130828.GA1314@momjian.us> <20141209204337.GC24488@momjian.us> <55AA2469.20306@dalibo.com> <55AA27C3.7060009@dalibo.com> <20150902135351.GA5286@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Pg-Spam-Score: -4.2 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2015-09-02 19:49:13 +0100, Greg Stark wrote: > I can take the blame for this formula. > > It's called the "Coupon Collector Problem". If you hit get a random > coupon from a set of n possible coupons, how many random coupons would > you have to collect before you expect to have at least one of each. My point is that that's just the entirely wrong way to model prefetching. Prefetching can be massively beneficial even if you only have a single platter! Even if there were no queues on the hardware or OS level! Concurrency isn't the right way to look at prefetching. You need to prefetch so far ahead that you'll never block on reading heap pages - and that's only the case if processing the next N heap blocks takes longer than the prefetch of the N+1 th page. That doesn't mean there continously have to be N+1 prefetches in progress - in fact that actually often will only be the case for the first few, after that you hopefully are bottlnecked on CPU. If you additionally take into account hardware realities where you have multiple platters, multiple spindles, command queueing etc, that's even more true. A single rotation of a single platter with command queuing can often read several non consecutive blocks if they're on a similar - Andres -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers