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 1sgl6X-007JKY-0f for pgsql-hackers@arkaria.postgresql.org; Wed, 21 Aug 2024 13:10:25 +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 1sgl6U-00Awqh-Ub for pgsql-hackers@arkaria.postgresql.org; Wed, 21 Aug 2024 13:10:23 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgl6U-00AwqH-L3 for pgsql-hackers@lists.postgresql.org; Wed, 21 Aug 2024 13:10:23 +0000 Received: from mail-yw1-x112a.google.com ([2607:f8b0:4864:20::112a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sgl6S-000jUM-LL for pgsql-hackers@postgresql.org; Wed, 21 Aug 2024 13:10:21 +0000 Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-6aab656687cso6495897b3.1 for ; Wed, 21 Aug 2024 06:10:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724245820; x=1724850620; darn=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=eNavfM0CNXD53i4X8rXOQZmW67qtNyro6cE/3y5C7ME=; b=Z80tmHLBRi6fh09In/ylFMDnQEHwF7sjWdZHIQq6s3aze/LfFxe+NTro4nTLNhoU/z cyUmikMf3Ebv3woiAnUDlTCBbr/xKBiHffIrFjX/Kv5Gz2ZMRMP3O+TN9PAoR77DlLY+ m2a1EwcpwaB11FWeaSvRktmWQrQllckMgJIv2lgEVPDF+idxjNrmCLMAU3FYroyKe3/K ziA+skMG8dg3BVTN4Ri/pb+P22W8BEPci6pBUTCxEIxHr4Eh1bLn+Hg2EQTkZEwEcHnD hPkzHS1ieT8V4fzb49iKTAMgeU7CNM3v2KGN8QA1KFcvKc+2np9xPaPGb0qH6mD5zgBN hwjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724245820; x=1724850620; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eNavfM0CNXD53i4X8rXOQZmW67qtNyro6cE/3y5C7ME=; b=hwP+GSASXfiK9zHZzds5YKffngfXRtCXF7EUTjfGinYdIINqwLVU2XwYVSrbmwcL+L XhlMxykbrJgzuPfYJXHcpDOtlq32cL0Gi4icwE25kRVXixAeEWR4kkBjibgZkREBEUUi qJswnat1OaJSEDpWasFTi2Itxc4A/YThV2VF9Xx6IUo9+IHuAKYvKEUcbTDraJAmr2cd G+0vqpQMVeH/fV97ATLcdKA+fT622beSYvcE6VTVIUPWLbluSSxEE+POzet3E5g5RSAi 13dy6cMhiMysnraYFmkYsgX0hKCortvhH/EJA/f5a2HE9p60MYjXxArFJ7ldJj1fhX9m NXRQ== X-Forwarded-Encrypted: i=1; AJvYcCXcqYE6pN/xmy2I8xzzlzuJABueJOml+wBnjFUz4O7FZas0s2MonF0+5Ax0xElMsgo4BNMT3k3piid8GHn/@postgresql.org X-Gm-Message-State: AOJu0Yzenw0D7o+ed9N68ls1Tc6SFApFMd3tYpJGciO/bDdxbiVTyvyo 2Z612JOiHVMbhQQlAtyMtsSnJ1Ko4TNuDtn92Xxp6/tCW4t34uHQsZoRTlKabYZNrQr0tvkcKWI jHXx/laYyAJiVX+nURDsFTGAfeEM= X-Google-Smtp-Source: AGHT+IHW4MLvRrTpJFlNWRCtWEF/hkmtvtgQsQlzB3xAsMRcJ6UHqFEiU32rCzd8qXXG4VO64Qiyt99hFZa5FP9J/ko= X-Received: by 2002:a05:690c:dc3:b0:65f:7c41:30b2 with SMTP id 00721157ae682-6c0d8b77de9mr14369797b3.3.1724245819608; Wed, 21 Aug 2024 06:10:19 -0700 (PDT) MIME-Version: 1.0 References: <202406191709.jbvpf7d7hl6g@alvherre.pgsql> In-Reply-To: From: Robert Haas Date: Wed, 21 Aug 2024 09:10:06 -0400 Message-ID: Subject: Re: generic plans and "initial" pruning To: Amit Langote Cc: Alvaro Herrera , Andres Freund , Daniel Gustafsson , David Rowley , PostgreSQL Hackers , Thom Brown , Tom Lane 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, Aug 21, 2024 at 8:45=E2=80=AFAM Amit Langote wrote: > * The replanning aspect of the lock-in-the-executor design would be > simpler if a CachedPlan contained the plan for a single query rather > than a list of queries, as previously mentioned. This is particularly > due to the requirements of the PORTAL_MULTI_QUERY case. However, this > option might be impractical. It might be, but maybe it would be worth a try? I mean, GetCachedPlan() seems to just call pg_plan_queries() which just loops over the list of query trees and does the same thing for each one. If we wanted to replan a single query, why couldn't we do fake_querytree_list =3D list_make1(list_nth(querytree_list, n)) and then call pg_plan_queries(fake_querytree_list)? Or something equivalent to that. We could have a new GetCachedSinglePlan(cplan, n) to do this. > * Polish the patch for the old design of doing the initial pruning > before AcquireExecutorLocks() and focus on hashing out any bugs and > issues of that design. That's also an option. It probably has issues too, but I don't know what they are exactly. --=20 Robert Haas EDB: http://www.enterprisedb.com