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 1uIHzC-001gur-1D for pgsql-hackers@arkaria.postgresql.org; Fri, 23 May 2025 02:18:14 +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 1uIHz8-00CXcy-9S for pgsql-hackers@arkaria.postgresql.org; Fri, 23 May 2025 02:18:10 +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 1uIHz7-00CXci-U1 for pgsql-hackers@lists.postgresql.org; Fri, 23 May 2025 02:18:09 +0000 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uIHz5-000ROT-0N for pgsql-hackers@postgresql.org; Fri, 23 May 2025 02:18:09 +0000 Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-ae727e87c26so5185002a12.0 for ; Thu, 22 May 2025 19:18:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747966685; x=1748571485; 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=szy/TXKiyd5kLq1454HbIGZqzyRh+AUiHDN8TaU/DEs=; b=AiIHhFGdhwZvaLlQ4ipbQkdxJ0ONpQfmNB2EcRw8bWPeRIwZaz846IbuJ/8bKndK4K QozJkDkD5I2KNDRCY7iuki1su3DzyfzfOscZlQOh3TprjGS9t5dSXe7PusdXwvbo+z3m FTja+kD3LZ068A4XFmw81x94HlSVE8vPbQoEP2kqMZLNjGrUfX3PebAkY1s85NGhrhwX L7kDh4ojX5igPA7WSk57mZK6MwVIEDAKjc2sHq5wdX2RPm3VG52y73d7ASHfNUGTI+Qt YnzzPNQT270YYUxnJVH/Yvj5eCXTDjGgzW0y6hakPCxgz83HjP3aUht5YCy90QTDVWUe n8zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747966685; x=1748571485; 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=szy/TXKiyd5kLq1454HbIGZqzyRh+AUiHDN8TaU/DEs=; b=U98QJ3vq0YqiPNFZdXuCjHZyjLPhCaFfzmvgw0JYHF+JsYda/ZSW0MkUHJ2Bal0kEo 0ZAeU7sRU45MGwJVJHjmzdV09Hi7Kxv1/hNsMsqT38007aoR7f0TVTQ9BYZ4YkZeijiR kP35ZCrbQiflriuxFICDAvsCafXU12N56povL/tISBBXBme1Tulj8nRRN4vB0YOF6r9B rc3x/PfY0vz58BdU3plpWcoBlRgut8SGwGVZAzvofVZCr5lNuwHywqA9yJJY7Au8DwkU +AYYxWGsipm95VZ/6L8w9b5h7BdILp8lc/psIxV53yu0LaK1MrW/KJJ09zOVTlvyDXb3 f19g== X-Forwarded-Encrypted: i=1; AJvYcCVnhSwS4mABn3kauCkHl49NDF+cvIJB2e/Y/okfeE5O0QKqlhnVakaQSZu5Xa+1e6rj8//XZKdLNoYklGzC@postgresql.org X-Gm-Message-State: AOJu0Yy2vS4bWdAiMpPAjYl6rqlEwWv04V4WwyrqRuX2NWwB6Cz2hjmo lNI81AL/CdUge4fdGpcCozCe3qZq069iySojyju6Uu4osPm716zAt7NTA9LsQZJETWcuRwHFGd7 VAxvfpkNYzFIJEl9Mi2CG8fSu9SLITiM= X-Gm-Gg: ASbGncsgGP2uzSyZLG3u4pJGtNsg5TqwyXXlK1lgWlipek/SeRqXO5gYSFWUo9cD9Xp s3+x56fsx0QvxzL+o4t3CG0hrJndCdZ2WVoXcHzIpjJg6UyJ51QKpa1sXBkezukXy5zcl00DCLS ARZL2uktKGB43wg8Ju8fGtkLdiePgUR7byew== X-Google-Smtp-Source: AGHT+IEKaiMHCB0dN1nLEMQWNmoN3DnWJ9OWLirU92AP6EC5OPB2x7vMx6mtmTHjIltKIg82IGXnnd6j8XDABG5J39M= X-Received: by 2002:a17:902:dad2:b0:231:ecd5:e705 with SMTP id d9443c01a7336-231ecd5ea1bmr398438265ad.28.1747966684920; Thu, 22 May 2025 19:18:04 -0700 (PDT) MIME-Version: 1.0 References: <605328.1747710381@sss.pgh.pa.us> <691261.1747755511@sss.pgh.pa.us> In-Reply-To: From: Amit Langote Date: Fri, 23 May 2025 11:17:48 +0900 X-Gm-Features: AX0GCFvBlFAIX9JwppVyII6mzy3FSioGmnL90EvFfEeNGqGquXfy6BgXCOrxjkM Message-ID: Subject: Re: generic plans and "initial" pruning To: Tomas Vondra Cc: Tom Lane , Tender Wang , Alexander Lakhin , Robert Haas , Alvaro Herrera , Andres Freund , Daniel Gustafsson , David Rowley , PostgreSQL Hackers , Thom Brown 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 Thu, May 22, 2025 at 10:04=E2=80=AFPM Tomas Vondra wro= te: > On 5/22/25 10:12, Amit Langote wrote: > > Note that I=E2=80=99ve only reverted the changes related to deferring l= ocks on > > prunable partitions. I=E2=80=99m planning to leave the preparatory comm= its > > leading up to that one in place unless anyone objects. For reference, > > here they are in chronological order (the last 3 are bug fixes): > > > > bb3ec16e14d Move PartitionPruneInfo out of plan nodes into PlannedStmt > > d47cbf474ec Perform runtime initial pruning outside ExecInitNode() > > cbc127917e0 Track unpruned relids to avoid processing pruned relations > > 75dfde13639 Fix an oversight in cbc127917 to handle MERGE correctly > > cbb9086c9ef Fix bug in cbc127917 to handle nested Append correctly > > 28317de723b Ensure first ModifyTable rel initialized if all are pruned > > > > I think separating initial pruning from plan node initialization is > > still worthwhile on its own, as evidenced by the improvements in > > cbc127917e. > > > > I'm OK with that in principle, assuming the benefits outweigh the risk > of making backpatching harder. The patches don't seem exceptionally > large / invasive, but I don't know how often we modify these parts. Thanks. I agree it's something to be mindful of, but I don=E2=80=99t expect the reimplementation of the locking deferral to require changes to this part of the code again. So barring any surprises, it shouldn't be the case that the pruning code ends up looking significantly different in v19. Also, the actual pruning logic hasn=E2=80=99t changed much -- just where it= =E2=80=99s called from. Let me know if any of that still raises concerns. --=20 Thanks, Amit Langote