Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c6N4N-0004jX-9D for pgsql-performance@arkaria.postgresql.org; Mon, 14 Nov 2016 19:37:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1c6N4M-0001A4-QV for pgsql-performance@arkaria.postgresql.org; Mon, 14 Nov 2016 19:37:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1c6N4L-00019b-Us for pgsql-performance@postgresql.org; Mon, 14 Nov 2016 19:37:30 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1c6N4E-0004bw-Tv for pgsql-performance@postgresql.org; Mon, 14 Nov 2016 19:37:29 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id uAEJbLk3020826; Mon, 14 Nov 2016 14:37:21 -0500 From: Tom Lane To: Stephen Cresswell cc: pgsql-performance@postgresql.org Subject: Re: Why is the optimiser choosing a sub-optimal plan? In-reply-to: References: Comments: In-reply-to Stephen Cresswell message dated "Mon, 14 Nov 2016 17:53:43 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <20824.1479152241.1@sss.pgh.pa.us> Date: Mon, 14 Nov 2016 14:37:21 -0500 Message-ID: <20825.1479152241@sss.pgh.pa.us> X-Pg-Spam-Score: -4.7 (----) 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 Stephen Cresswell writes: > I have the a table with two indexes... (1) Tell us about the other table, mobile_summary_type. (2) Did you transcribe the second query plan correctly? I have a hard time believing that EXPLAIN printed two Index Cond lines for the same indexscan. (3) What PG version is this, exactly? (4) Are you doing anything funny like disabling autovacuum/autoanalyze? The rowcount estimates in the "good" plan seem rather far away from reality, and it's not obvious why, particularly here: > -> Seq Scan on mobile_summary_type mst > (cost=0.00..18.80 rows=880 width=64) (actual time=0.014..0.016 rows=4 > loops=1) 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