Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qQTGV-00017t-Pi for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Jul 2023 13:48:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qQTGT-000OPp-Fk for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Jul 2023 13:48:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qQTGT-000OPg-6H for pgsql-hackers@lists.postgresql.org; Mon, 31 Jul 2023 13:48:50 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qQTGN-0000el-Qv for pgsql-hackers@postgresql.org; Mon, 31 Jul 2023 13:48:50 +0000 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-686be3cbea0so3568606b3a.0 for ; Mon, 31 Jul 2023 06:48:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690811322; x=1691416122; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=uc7j4GRsSPwIHCQk3QD/PkUqNl6kQQP4OcbrCmT1AHM=; b=SzeKcHYqy9q3lYxEcxrtlekdAV/+xPrmZ7PqqfCq9elBH7dazQLGgYYmEjTFAJFG5P Bo/K2THwEpXfDMcA3ZyltlUM4iGo/z8SAtHwFuPUjpeXB5OKuUIdA8sNDiGXUnUZlBIN /EcA2BSPaK8wPJjpxqSSXA+5bkSJ4lVf7BtGxt8TAPNyGHK7IXlp9jind6VfdCwGe12e Z4V8SzFT4f7QRo4iqoxWaRafFRqYiDO0gp++BYIjLyZf/yvAAqb+FwLUxMPWyFPaGLLJ Pi167BgJlZcD3cEIocH3A+soJnMjWsvFw1NVC7rLW/uGF2RWD63HCD5tjDFnTr3FC5e7 ksWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690811322; x=1691416122; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uc7j4GRsSPwIHCQk3QD/PkUqNl6kQQP4OcbrCmT1AHM=; b=FVCCGrUIztYJt+JeMnVNJln0cI1gUjmBObSxvSG0u1WYtEyUHZHcryHPrMSaGiO2i0 mbpEkWkZmBdg+i5fpBHNEcEA9juW4uJTYQ8cxcl9gdNp7UozwUAu17mwwOMQdPvjDu7C Lf2Tz6BUscq3kH84xIcfFuu5r+NFKEmRpkMvHoUdWpi1tDVJoW0gXoze+qbs33u4m7cP l4f1rF4AaVO8vTySsU5yQiASEk/RNF+B7bKv56KyqtgR8kpliquQIurf/HSGLUvN6jE1 ir0gmlU7BzrODvFhYmkdh+gB0rj+CO/6ZNT2qfjrkxd7nnZelrmVeY/k0Lup0Pv+T5/V taMA== X-Gm-Message-State: ABy/qLZtoYwNhuW1R9V7eX6b6jiWi6moDOF0ao3gDfJvU47vvVPmwwBT EbEsDhSrxAouNLdwHLyLfB3hQGY3In4= X-Google-Smtp-Source: APBJJlF+O9c4upOZAKxFgqTD6QGOZEcAu+8woV61P6Kgky8vP7/SsY6WnZW3sMZ2gmm4GtpzdEkHaQ== X-Received: by 2002:a17:90b:4f47:b0:267:f8f3:6584 with SMTP id pj7-20020a17090b4f4700b00267f8f36584mr11840078pjb.6.1690811321802; Mon, 31 Jul 2023 06:48:41 -0700 (PDT) Received: from jrouhaud (2001-b011-1006-38ed-09e3-8c42-e7cb-f576.dynamic-ip6.hinet.net. [2001:b011:1006:38ed:9e3:8c42:e7cb:f576]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a19c900b00267c49d74e8sm8601329pjj.42.2023.07.31.06.48.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 06:48:41 -0700 (PDT) Date: Mon, 31 Jul 2023 21:48:37 +0800 From: Julien Rouhaud To: =?utf-8?B?6Kyd5p2x6ZyW?= Cc: pgsql-hackers@postgresql.org Subject: Re: Improve join_search_one_level readibilty (one line change) Message-ID: <20230731134837.dpugorvuhtv27b3t@jrouhaud> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Wed, Jun 07, 2023 at 11:02:09AM +0800, 謝東霖 wrote: > Thank you, Julien, for letting me know that cfbot doesn't test txt files. > Much appreciated! Thanks for posting this v2! So unsurprisingly the cfbot is happy with this patch, since it doesn't change the behavior at all. I just have some nitpicking: @@ -109,14 +109,14 @@ join_search_one_level(PlannerInfo *root, int level) List *other_rels_list; ListCell *other_rels; + other_rels_list = joinrels[1]; + if (level == 2) /* consider remaining initial rels */ { - other_rels_list = joinrels[level - 1]; other_rels = lnext(other_rels_list, r); } else /* consider all initial rels */ { - other_rels_list = joinrels[1]; other_rels = list_head(other_rels_list); } Since each branch only has a single instruction after the change the curly braces aren't needed anymore. The only reason keep them is if it helps readability (like if there's a big comment associated), but that's not the case here so it would be better to get rid of them. Apart from that +1 from me for the patch, I think it helps focusing the attention on what actually matters here.