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 1pIlgQ-0000tw-TI for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Jan 2023 07:19:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pIlgP-0000yR-F0 for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Jan 2023 07:19:29 +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 1pIlgP-0000vc-3e for pgsql-hackers@lists.postgresql.org; Fri, 20 Jan 2023 07:19:29 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pIlgM-0004Ls-Lk for pgsql-hackers@postgresql.org; Fri, 20 Jan 2023 07:19:28 +0000 Received: by mail-pl1-x630.google.com with SMTP id v23so4628808plo.1 for ; Thu, 19 Jan 2023 23:19:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=JJfct/LIcfvP1dGNeg0UuPokuVhgdpD6XXOS0/xolXQ=; b=nByBS7aznnkKPDXMV3Mb5UiMkib5PaVCPiWfbLA5W5dqDFv9u6q30U8vGvmdWnJCS/ g0cqApz2Ae9myr5MM5fblPZXAgV07XjUv5ll/m3pkkNkCNIFLrQ/7gh40NS+jaDTo/No GMn7tbVxMYXTSW8AcLJqQaJvYzRGeZB9uFfruakD3EE0cM8AjdgxfnamG9RGeh8Ylu/E bUG56CUzni3YQgS2nDjtEwui9CIMLMPX0q3ilYbZ7jOeooFNgMc2zpEuCc2An/bS+HWX uexXMhwWKI+jU+lbBq5pUa8ke/BFvQqpA3nJ65v7/xYtGvqPYL6kBIEtXkJ8m7p41ifo Kflw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=JJfct/LIcfvP1dGNeg0UuPokuVhgdpD6XXOS0/xolXQ=; b=m6f4LR6M/QKOPa6brLQs71iOn+xgyykT4LPItvHkU1UoXgHj8hCpKf52WTpUt5DB8Y c1sLZ5ele3kOdV1NBccMKtf3OH6ycWkmZTzs+X3AkF5Y4wK3EZ6sNU0b7nEfPVRWC7sv 2aRzktgEgRWxYU6UBd8qrlN55GrQl5ux4eKDGLih7p0bigyFuGO4ljtbhvGDWOUqIBPW 0N/TfX94i5ZTU3UG3GBOEzHHHYgx5W3xhiTbtlOqrLEhoNImtiDate3L11bJyky4sgot y4vjCL1RIRYT5nhCJGcbRo0z0YxAiMi3PM7oxAeJrXMnFosrPKFLr95w1PX66kI2+L1w uFMg== X-Gm-Message-State: AFqh2komFMJW0GV0OYyq5Bvpvs1nFEpRXSH7qALcA5/zGWOHvW+L8ovi /3kdR4RNaWfmjq5idj/f/Ze6kZYOPNN6apbWNSs= X-Google-Smtp-Source: AMrXdXuUV8k7ouzhwbpTrLXGLA9Csnw3H/j4B9ViMPStFJFPQqey7+8AMvLxGAm3wWfqp77O9NgzdTfa9GWeeIFSK+g= X-Received: by 2002:a17:90a:989:b0:228:e4ad:f0c5 with SMTP id 9-20020a17090a098900b00228e4adf0c5mr1402654pjo.174.1674199165513; Thu, 19 Jan 2023 23:19:25 -0800 (PST) MIME-Version: 1.0 References: <20221221101846.7zsi7lscnm5ediik@alvherre.pgsql> <1350682.1671635927@sss.pgh.pa.us> <4191508.1674157166@sss.pgh.pa.us> <349124.1674185509@sss.pgh.pa.us> <352017.1674187116@sss.pgh.pa.us> In-Reply-To: <352017.1674187116@sss.pgh.pa.us> From: Amit Langote Date: Fri, 20 Jan 2023 16:19:08 +0900 Message-ID: Subject: Re: generic plans and "initial" pruning To: Tom Lane Cc: Alvaro Herrera , Robert Haas , Jacob Champion , David Rowley , PostgreSQL-development Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Jan 20, 2023 at 12:58 PM Tom Lane wrote: > Amit Langote writes: > > On Fri, Jan 20, 2023 at 12:31 PM Tom Lane wrote: > >> It might be possible to incorporate this pointer into PlannedStmt > >> instead of passing it separately. > > > Yeah, that would be less churn. Though, I wonder if you still hold > > that PlannedStmt should not be scribbled upon outside the planner as > > you said upthread [1]? > > Well, the whole point of that rule is that the executor can't modify > a plancache entry. If the plancache itself sets a field in such an > entry, that doesn't seem problematic from here. > > But there's other possibilities if that bothers you; QueryDesc > could hold the field, for example. Also, I bet we'd want to copy > it into EState for the main initialization recursion. QueryDesc sounds good to me, and yes, also a copy in EState in any case. So I started looking at the call sites of CreateQueryDesc() and stopped to look at ExecParallelGetQueryDesc(). AFAICS, we wouldn't need to pass the CachedPlan to a parallel worker's rerun of InitPlan(), because 1) it doesn't make sense to call the plancache in a parallel worker, 2) the leader should already have taken all the locks in necessary for executing a given plan subnode that it intends to pass to a worker in ExecInitGather(). Does that make sense? -- Thanks, Amit Langote EDB: http://www.enterprisedb.com