Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UPzA2-000538-V9 for pgsql-performance@arkaria.postgresql.org; Wed, 10 Apr 2013 17:50:19 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UPzA2-0002bp-Ay for pgsql-performance@arkaria.postgresql.org; Wed, 10 Apr 2013 17:50:18 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UPzA1-0002bj-7S for pgsql-performance@postgresql.org; Wed, 10 Apr 2013 17:50:17 +0000 Received: from proofpoint1.mail.rice.edu ([128.42.201.100] helo=pp1.rice.edu) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UPz9y-0005Yj-Aj for pgsql-performance@postgresql.org; Wed, 10 Apr 2013 17:50:16 +0000 Received: from pps.filterd (pp1.rice.edu [127.0.0.1]) by pp1.rice.edu (8.14.5/8.14.5) with SMTP id r3A9r3uw024158; Wed, 10 Apr 2013 12:49:52 -0500 Received: from mh3.mail.rice.edu (mh3.mail.rice.edu [128.42.199.10]) by pp1.rice.edu with ESMTP id 1bmv0sggbx-1; Wed, 10 Apr 2013 12:49:52 -0500 X-Virus-Scanned: by amavis-2.7.0 at mh3.mail.rice.edu, auth channel X-SMTP-Auth: no X-SMTP-Auth: no Received: from aart.rice.edu (aart.rice.edu [168.7.56.48]) by mh3.mail.rice.edu (Postfix) with ESMTP id 8F4E14016D; Wed, 10 Apr 2013 12:49:52 -0500 (CDT) Received: by aart.rice.edu (Postfix, from userid 18612) id 8741E10063A; Wed, 10 Apr 2013 12:49:52 -0500 (CDT) Date: Wed, 10 Apr 2013 12:49:52 -0500 From: "ktm@rice.edu" To: Steve Singer Cc: pgsql-performance@postgresql.org Subject: Re: slow bitmap heap scans on pg 9.2 Message-ID: <20130410174952.GA32580@aart.rice.edu> References: <51656E03.7000701@ca.afilias.info> <20130410135657.GY32580@aart.rice.edu> <51658BB0.4000808@ca.afilias.info> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51658BB0.4000808@ca.afilias.info> User-Agent: Mutt/1.5.20 (2009-12-10) X-Pg-Spam-Score: -4.3 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On Wed, Apr 10, 2013 at 11:56:32AM -0400, Steve Singer wrote: > On 13-04-10 09:56 AM, ktm@rice.edu wrote: > >On Wed, Apr 10, 2013 at 09:49:55AM -0400, Steve Singer wrote: > > > > >Hi Steve, > > > >The one thing that stands out to me is that you are working with 200GB of > >data on a machine with 4-8GB of ram and you have the random_page_cost set > >to 2.0. That is almost completely uncached and I would expect a value of > >10 or more to be closer to reality. > > Setting random_page_cost to 15 makes the planner choose the > nested-loop plan (at least the date range I tried). > > I thought that the point of effective cache size was to tell the > planner high likely it is for a random page to be in cache. With > 200GB of data for this query and an effective cache size of 3.5 GB I > would have expected that to be accounted for. > For random_page_cost to be that low, the database would need to be mostly cached. 3.5GB is almost 100X too small to do that unless your query exhibits a large amount of locality of reference. Values for random_page_cost between 10 and 20 are very reasonable for disk-bound I/O scenarios. Regards, Ken -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance