Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kECu7-0001J3-Qu for pgsql-general@arkaria.postgresql.org; Fri, 04 Sep 2020 14:41:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kECu6-0002GL-OR for pgsql-general@arkaria.postgresql.org; Fri, 04 Sep 2020 14:41:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kECu6-0002GD-Gm for pgsql-general@lists.postgresql.org; Fri, 04 Sep 2020 14:41:26 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kECu4-0004Ez-9o for pgsql-general@lists.postgresql.org; Fri, 04 Sep 2020 14:41:25 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 084EfLUb874452; Fri, 4 Sep 2020 10:41:22 -0400 From: Tom Lane To: Klaudie Willis cc: Laurenz Albe , PostgreSQL General Subject: Re: Bitmap scan seem like such a strange choice when "limit 1" In-reply-to: References: Comments: In-reply-to Klaudie Willis message dated "Fri, 04 Sep 2020 13:01:34 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <874450.1599230481.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Sep 2020 10:41:21 -0400 Message-ID: <874451.1599230481@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Klaudie Willis writes: > I'd like to add, that when I do the same query DIRECTLY on the bigtable_= y2020 (instead of the partition parent) it does change to "index scan" aga= in. Yeah. I think the issue here is that add_paths_to_append_rel only considers cheapest-total paths for the member relations. Seeing that it's already considering a slightly ridiculous number of parallelization options, I'm hesitant to throw in cheapest-startup considerations as well, for fear of blowing out planning time. Maybe the right way to improve this is to bypass add_paths_to_append_rel entirely when there's exactly one surviving child rel, and make it just use all the surviving paths for that child. regards, tom lane