Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TjDtc-0002FG-1e for pgsql-performance@arkaria.postgresql.org; Thu, 13 Dec 2012 18:52:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TjDtb-00039f-2y for pgsql-performance@arkaria.postgresql.org; Thu, 13 Dec 2012 18:52:35 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Titux-00039P-9k for pgsql-performance@postgresql.org; Wed, 12 Dec 2012 21:32:39 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tituu-0003E4-7p for pgsql-performance@postgresql.org; Wed, 12 Dec 2012 21:32:37 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBCLWYHG016432 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 12 Dec 2012 16:32:34 -0500 Received: from sss.pgh.pa.us (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qBCLWXJW019412; Wed, 12 Dec 2012 16:32:34 -0500 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id qBCLWXOT015322; Wed, 12 Dec 2012 16:32:33 -0500 (EST) From: Tom Lane To: Andrew Dunstan cc: pgsql-perform Subject: Re: encouraging index-only scans In-reply-to: <50C8F1EC.9010801@dunslane.net> References: <50C8F1EC.9010801@dunslane.net> Comments: In-reply-to Andrew Dunstan message dated "Wed, 12 Dec 2012 16:06:52 -0500" Date: Wed, 12 Dec 2012 16:32:33 -0500 Message-ID: <15321.1355347953@sss.pgh.pa.us> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Pg-Spam-Score: -6.9 (------) 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 Andrew Dunstan writes: > A client is testing a migration from 9.1 to 9.2, and has found that a > large number of queries run much faster if they use index-only scans. > However, the only way he has found to get such a plan is by increasing > the seq_page_cost to insanely high levels (3.5). Is there any approved > way to encourage such scans that's a but less violent than this? Is the pg_class.relallvisible estimate for the table realistic? They might need a few more VACUUM and ANALYZE cycles to get it into the neighborhood of reality, if not. Keep in mind also that small values of random_page_cost necessarily decrease the apparent advantage of index-only scans. If you think 3.5 is an "insanely high" setting, I wonder whether you haven't driven those numbers too far in the other direction to compensate for something else. regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance