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.96) (envelope-from ) id 1wD6Ci-002bnn-1a for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Apr 2026 19:47:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wD6Ch-001xPp-2I for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Apr 2026 19:47:15 +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.96) (envelope-from ) id 1wD6Ch-001xPg-1C for pgsql-hackers@lists.postgresql.org; Wed, 15 Apr 2026 19:47:15 +0000 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wD6Ce-00000001HNt-3kfv for pgsql-hackers@lists.postgresql.org; Wed, 15 Apr 2026 19:47:15 +0000 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-b9c1da7ac63so1149504766b.0 for ; Wed, 15 Apr 2026 12:47:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776282431; cv=none; d=google.com; s=arc-20240605; b=KVAXjuyvjkN9/JdQ8gDYtf6FuhwckRjfMVCkI6dJXWfZXkqxKVuYM196ChZPMNTAYS aymdJevytWUpdxlzsNQJDOWg3Z8FMXOFh3Yw2vAJLs6hRl5idbHEXdbkFKOl/0Fhow3M frC2K1DUmu/UO8dtniGezPl3b6YAe9L2Md6K7UNRafT3hLovnV/ccfQxqi0J86Mu5NpC 4kaBG7Nn+k4jJFhY4bcGwONE7Srx3/jNFbkCKi60eWfsIz5b3kIQ/502pnDaxL0/E374 kfuHfS7baEvha7lNYd64/VOD2amosghEWbS0qIlKL5wED1N48lg6ZoTIEPMnVMpjEknO mVTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=fUzTfyfXZ62Lh5QBl2tN1OKFRQG1DEZLYIQrensgkIc=; fh=vVUycfCtBcipmkIcgNUrfiKC+2nd+LPUguUu9cvYn/U=; b=drRoI9zCU8WBAeKqgvsGDo20lq8+tEogVsRYrpr6NQL6XuzHQ+1D0GLOlY6cHC/lDA uumbhB7CIJpuRCoCWLNmTzqHuWU72WL7w1uSblL8cdMg3OaMjwYj/7i4dbbsT0Cw/S2e ts3A6Aa5WzT8leUuY+kIjPQDX4hkoLCTFE2UE11mVYRJ30FvTfKXEQsXqoxWcjA1tYXu OeqURgd44rEphVuW9yWYWoNU0BagF7Sk3TvrFuXJLnAjgUJb3guFHkGveNksT+jbmXjv ItvJD17KgvYDuugx6Tu9L5ERbWDgSmaObS8M2ieoBD6+GIcuHWvurQhYgUqGSV+P6pGd J9Sg==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776282431; x=1776887231; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=fUzTfyfXZ62Lh5QBl2tN1OKFRQG1DEZLYIQrensgkIc=; b=ayrkqQaY+rY5fzvFvXefhkw9C07QLMi4zTcwrVKzxwQCtVCbsLrEWY0LVaXgZ8Vip/ HoFCIqqmNYjr3ipy2Je6PmsqqDdUmoe7gJRuomjT2M+b2w5+FUB4Q/pPfId9L4zIpAba GQuqPqQv40gNY4EkSxEz67WkGEQA8+Jv6DwhCOy17F18LGvINDyZQwFrQ+fXWvVLDDem EmIjA48kvl0MoSkeRJEu2dl/vnJFnQB8POyu4LZ4C0zNCRoMhV8HCJtCVtNbT3aIWuyJ SyPvtphVn6zzQjaMN3gbqRrNAEjuVsgh88kqWTvjKlihn8Ob9mo0/q+JIappnbB5FMyt KnEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776282431; x=1776887231; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=fUzTfyfXZ62Lh5QBl2tN1OKFRQG1DEZLYIQrensgkIc=; b=ECR+pSsQF3Ooj9Lt7HFKVPwo5Dn/LkiYBm9usXad6nKtozBkI4ZWehYydaKZI3qmw6 YKestfrV9H8KTkWK6tyempJJo3kF3f7EgHLLmcGGsaBLiO2j0NF1+dHp8Z8LonkplZkR WiNHsOhXrqzi/Ue3B0XxucyakwumaTpuSz+jNsLS97AmFSTH/g45W3DshQhOIFvLIwdw mGN7KPf3a4vJW2tVQLTSyvCWM0Kzt29TslYiNSn4XMI/g8r7RsZqLoW2FCumF2cmK5eX +LMTRt0n5gmT7VDTN+wH5CAMezlk+J49Bq3+dRjhpoKq4GtrcJkNflMnfx8c2px3T2iq 7KWw== X-Forwarded-Encrypted: i=1; AFNElJ9bpJrTZuLwRgh6/IQHk85YIB6xPy3ZdPWJCKyIIIoyjO1i5paFdiiFzWmbx94MbsOj0m8YSfX5IntnZXFG@lists.postgresql.org X-Gm-Message-State: AOJu0YzaukI5znJh8Kdq2rsyMi90UW/nIVVQA1GRZUoKWBE4Fj8+JVEZ NnWt5JlCSo7rtlzI3Wnb3UilyR/myoYSTKNuFRo6Ntb3Vf8QbO/ohQlsQuso958IXIJLz5YFcK+ j30ftbDLsR2Nr8gDZFthblaaYtMQoFOU= X-Gm-Gg: AeBDiesTA4uo4ReHRR918rXxXJXkWxb/AKk7QWceCyW3s9QpatVYG6psU5lym39HKPK zluGfaZPOC6bOrW3JiXNhvxGE0obxHJ9ROBOQ0/GeHNmWUN4vINdYjYdXzMy7VKAhPM27Sg5d5D FL1o1YiJmcJoqyOZL8Y7tzDpbfVQKtl7P5Fdb+2yJtwLzqY026iJcnboO6IYc+GNTc4DQDFZShA /Dau80sYCs7j+mkxoGHbEVROfvaZ+ETiUJ1TCICfyVs9PwPVA6xsZKmH9SgTvk5YYWmNNAoZjnV sak5BmTbG585yj2h5fBUl/OhL94GeQAqZFwFAbFOmgUzWGcnXw== X-Received: by 2002:a17:907:1582:b0:b97:6147:def1 with SMTP id a640c23a62f3a-b9d727aa511mr860857866b.33.1776282431368; Wed, 15 Apr 2026 12:47:11 -0700 (PDT) MIME-Version: 1.0 References: <3683430.1775173413@sss.pgh.pa.us> <3817825.1775240432@sss.pgh.pa.us> <3877210.1775272486@sss.pgh.pa.us> <2672940.1775599547@sss.pgh.pa.us> In-Reply-To: From: Robert Haas Date: Wed, 15 Apr 2026 15:46:58 -0400 X-Gm-Features: AQROBzAoFZ0JLaonQNXbd2x8B5UpQYmNjTbtRCAzPJ4TJ7XbBwqydpDmG6sjkHM Message-ID: Subject: Re: pg_plan_advice To: Tender Wang Cc: Alexander Lakhin , Melanie Plageman , Nathan Bossart , Tom Lane , Lukas Fittl , PostgreSQL Hackers , "heikki.linnakangas" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Apr 15, 2026 at 6:30=E2=80=AFAM Tender Wang wr= ote: > In the plan_showdown phase, in pgpa_qf_add_plan_rtis(), we can add 7, > 5, and 3 to qf->relids. > It seems difficult to add "6" to qf->relids when walking through the > plan tree.(Maybe have an easy way, I don't know too much > pg_plan_advice related code). Thanks for looking through this. sj_unique_rtis is actually not set from the plan tree walk, but based on the calls to pgpa_join_path_setup that occur during planning, so it makes sense that the join RTI crept in there. I'm guessing that this is another place that needs a call to pgpa_filter_out_join_relids -- I've had a few of those bugs already. --=20 Robert Haas EDB: http://www.enterprisedb.com