Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tfwaq-0005Uh-Pw for pgsql-performance@arkaria.postgresql.org; Tue, 04 Dec 2012 17:47:41 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1Tfwap-0005Rq-QS for pgsql-performance@arkaria.postgresql.org; Tue, 04 Dec 2012 17:47:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tfwao-0005Rk-QH for pgsql-performance@postgresql.org; Tue, 04 Dec 2012 17:47:38 +0000 Received: from li188-192.members.linode.com ([178.79.132.192] helo=foo.me.uk) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tfwam-0001GA-Uk for pgsql-performance@postgresql.org; Tue, 04 Dec 2012 17:47:38 +0000 Received: from webmail.cantabcapital.com ([212.44.17.222] helo=CCPPRT350008) by foo.me.uk with esmtpa (Exim 4.71) (envelope-from ) id 1TfwuE-0001Gv-5n for pgsql-performance@postgresql.org; Tue, 04 Dec 2012 18:07:42 +0000 From: To: "'postgres performance list'" References: <092a01cdd230$ff6143c0$fe23cb40$@foo.me.uk> In-Reply-To: Date: Tue, 4 Dec 2012 17:47:29 -0000 Message-ID: <096f01cdd247$722264a0$56672de0$@foo.me.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQE7bKfasxp9xMk0I5yxURpgMQ+bBAG7NE8VAUNOjpICTD/jZpkDX2Ng Content-Language: en-gb X-SA-Exim-Connect-IP: 212.44.17.222 X-SA-Exim-Mail-From: pscott@foo.me.uk X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on foo.me.uk X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.1 Subject: Re: Slow query: bitmap scan troubles X-SA-Exim-Version: 4.2.1 (built Sat, 07 Nov 2009 20:03:47 +0000) X-SA-Exim-Scanned: Yes (on foo.me.uk) X-Pg-Spam-Score: -1.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 >> But the row estimates are not precise at the top of the join/filter. >> It thinks there will 2120 rows, but there are only 11. >Ah... I didn't spot that one... Yes, you are right there - this is probably a slightly atypical query of this sort actually, 2012 is a pretty good guess. On Claudio's suggestion I have found lots more things to read up on and am eagerly awaiting 6pm when I can bring the DB down and start tweaking. The effective_work_mem setting is going from 6Gb->88Gb which I think will make quite a difference. I still can't quite wrap around my head why accessing an index is expected to use more disk access than doing a bitmap scan of the table itself, but I guess it does make a bit of sense if postgres assumes the table is more likely to be cached. It's all quite, quite fascinating :) I'll let you know how it goes. - Phil -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance