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 1sgQFM-001yv6-AM for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Aug 2024 14:54:08 +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 1sgQFK-000Twc-3p for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Aug 2024 14:54:06 +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 1sgQFJ-000TwT-PU for pgsql-hackers@lists.postgresql.org; Tue, 20 Aug 2024 14:54:06 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sgQFD-000aFb-Uw for pgsql-hackers@postgresql.org; Tue, 20 Aug 2024 14:54:05 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-52f00ad303aso7255928e87.2 for ; Tue, 20 Aug 2024 07:53:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724165638; x=1724770438; 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=BQQGHOCuDioK2+9ExNCRz9yg/pvYOgpnQNpoQA+L4lw=; b=VdPBATCMdW/Uo7WVLqekSuzQP4Uux89LWCCgk3iuakHw/4otZeJkZdudXKnF66cejc i2utWwrSHzGyhUf8SYo940II+LCP3B0U1z5mwkxGFqYQAR5Vx+5A0M2hlKJXDHhz0EmB OSzgTYUM+Z/BOnfJmBUpznPGgagaYlxM05jS2ERFwPfKFY0Uxxc2zoFMaZmbRPbTSzpK xmCZgkL/4qhuBvfk+SiRnIAse0+zDDJA5+s9aENTSbC0p2kSMmMwadVsiF0MGmYSU/yF CwhjBskCZGZLAyqk/t0573PLpqpcNOOaFX6jsM91XkRQ29UGRlnU/pliD8OOGvxycxoF RNxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724165638; x=1724770438; 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=BQQGHOCuDioK2+9ExNCRz9yg/pvYOgpnQNpoQA+L4lw=; b=IqDiToOlzmpZYijWfQP8CTeJkTWArHSgQX6tU3h3Onq7ViKEns9/86Md4zwH3Bzie6 EMgKKMxpIKVJ1UNZjn7vvUOhdTym1ni2/QFJpxAw6l1V4KU4IYXg0IMLcMmuYXOaqxU7 VC6CQMOzjAcFo+BQvD0sWdCvydJe1/Zar1EKhrwrcHNIeDYBs8bXrpVxt3Z7gixIhqep K8Ybj2+UPoVwf2nhzDPYl5NVnChUuv7zw15ZLi4a10nEzUOOH5go3QgW2M226SIvpGXm bz5JF+MVPFDyi7i1KKQAnkSqVla6xZo9oY6zA2hU4ewCyjoAz78kt93ai+6X9XLHPm9N PjJg== X-Forwarded-Encrypted: i=1; AJvYcCW1QHIWjwviBp2g0ltof0h2YxEn7Ff85mXBsUk17rwmwhoXcek5N/xX9nIWDJ85+xJx76xWWOpUW4+tUjekNpSGfKMTL2XiKQN8XwhJ X-Gm-Message-State: AOJu0Yx8nKZoDtBBlGk6KobQl8Wn0hfQ4doy6s5hb5O75DNFcshAEwxJ Huf5zUVxDU2eANHhvjHOD+zefDRYE0XPn8i89mFk+iNX7iie0uw4LAgH0bWuN58NiH+D79/yIH7 VTO1FczX+AklCyi4A1zy0V7/8ELJDcg== X-Google-Smtp-Source: AGHT+IGFuYjb9bh7UIJZUjvVwXRml80kf5kW/1Z7uoGyVHplK/za/TBSVhwHuTKRkII08yQ7Lx/teYJtZGyEzdOM/YM= X-Received: by 2002:a05:6512:3086:b0:52c:e054:4149 with SMTP id 2adb3069b0e04-5331c6a1746mr9992070e87.15.1724165637201; Tue, 20 Aug 2024 07:53:57 -0700 (PDT) MIME-Version: 1.0 References: <202406191709.jbvpf7d7hl6g@alvherre.pgsql> In-Reply-To: From: Robert Haas Date: Tue, 20 Aug 2024 10:53:45 -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 Tue, Aug 20, 2024 at 9:00=E2=80=AFAM Amit Langote wrote: > I think we'd modify plancache.c to postpone the locking of only > prunable relations (i.e., partitions), so we're looking at only a > handful of concurrent modifications that are going to cause execution > errors. That's because we disallow many DDL modifications of > partitions unless they are done via recursion from the parent, so the > space of errors in practice would be smaller compared to if we were to > postpone *all* cached plan locks to ExecInitNode() time. DROP INDEX > a_partion_only_index comes to mind as something that might cause an > error. I've not tested if other partition-only constraints can cause > unsafe behaviors. This seems like a valid point to some extent, but in other contexts we've had discussions about how we don't actually guarantee all that much uniformity between a partitioned table and its partitions, and it's been questioned whether we made the right decisions there. So I'm not entirely sure that the surface area for problems here will be as narrow as you're hoping -- I think we'd need to go through all of the ALTER TABLE variants and think it through. But maybe the problems aren't that bad. It does seem like constraints can change the plan. Imagine the partition had a CHECK(false) constraint before and now doesn't, or something. --=20 Robert Haas EDB: http://www.enterprisedb.com