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 1tLHqm-00DtGO-N1 for pgsql-general@arkaria.postgresql.org; Wed, 11 Dec 2024 08:13:40 +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 1tLHqj-00E4lN-Rg for pgsql-general@arkaria.postgresql.org; Wed, 11 Dec 2024 08:13:39 +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 1tLGUK-00DBGx-LB for pgsql-general@lists.postgresql.org; Wed, 11 Dec 2024 06:46:25 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tLGUJ-002D22-87 for pgsql-general@postgresql.org; Wed, 11 Dec 2024 06:46:25 +0000 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-aa69077b93fso407915566b.0 for ; Tue, 10 Dec 2024 22:46:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733899583; x=1734504383; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=bEtn/xSFjaSkO9qbSpkU1lfVyHR0jYStlWQpwo65bTk=; b=dum46ltxMZ/K8kHnGA0C58PBEus1sBbubsMwKS9V3LzbkHxHGRFuH1p55h8ttHatHR LmE9/sdfziiiyP1KEuaLHklck0aUkZTc+f9ygdqTR/dnUA7eIijHOBKy/fDtXxso+P/A eGZdBR0dLljgAH9287F1IrtS5Phe4NYPsWUxh0iZ3/G2GP+LXxZY0QfTEfm8w95PEjL+ CbIFlY29Lnt9SkU1o7Y+wBk+5WLFCwSz7i7Jj4HE9AWE9XHa1dbO+tl6SQKsoMbax2em rytLaMVfIN1RUvhDthXbw/BV2c4C37jVJsRzSKvGnoxgGJvmL2CyoxFFa6e8F4cKtiMJ e/vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733899583; x=1734504383; 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=bEtn/xSFjaSkO9qbSpkU1lfVyHR0jYStlWQpwo65bTk=; b=IP1gtegKCKUNEai7LV9HpGa7hYzPJlds895cAX12+OKWDWxHg8NcHPUID+puoK7dUN WmTMC5LJFGjbMgSBZnV0Dx+O+apXpVpUUryf5nEk7nEdbMH5O/swBbixMVG1WCf07+SB R2UaT3K9UWt/i0lUKr+8TAEbd7ebEYWTgbqAoCERtt1Ghx9IiLanmnVuHAqudtwUqjjE 4pKWnOmFzxRQtseU0zpUP68myUyC4DfwfJlaBk+QsHGcN9iyKCOLc3FGFugE9rRjFxhx gA4Mo2r4h787hJpj8r5sC3Sn8bJyR+LMHM9A6pp42gBsSU6Sdj2bIYTL6bL04Y8OxhBV iKWA== X-Gm-Message-State: AOJu0YyhYmabU6/gC3IIYYRINWKuyAn2J/14Wmt5pXlIWbFDjA0SfsYu R/SgYlVwOvFdItwNfD3vle6z7EzAUHRP0atHD1x/OR57VKFdkU4cD3aXDiC4F1PxKwQoXWWCk2J uqe1b7JcdQDY96B54hxWZUu+rEjSYm2yg X-Gm-Gg: ASbGncsnL03JAaKTuckGd0p20uKdiPghbZiePhZftVReHNfcrEkLvT89/szMesqbotW yWljVmNCA+oMkpL2HG4omta06szno3IBv/5hWXw/Qp3ncLswY0n5guTwoDOZOMt+FAHk= X-Google-Smtp-Source: AGHT+IF2dstlbeIdGk3hhbsAndhWjJMpdzcwAhBnLkMnMBSUF7Hk+Z6sNltdkYgQtv8NEk/aWKK5FRsq6wHPw9Jx/Ak= X-Received: by 2002:a17:907:cc14:b0:aa6:727a:2af8 with SMTP id a640c23a62f3a-aa6b13c9006mr113178166b.37.1733899582557; Tue, 10 Dec 2024 22:46:22 -0800 (PST) MIME-Version: 1.0 References: <928c165be24ee307c2fbaa29a2c6360eb8a00e02.camel@cybertec.at> In-Reply-To: From: Bolaji Wahab Date: Wed, 11 Dec 2024 07:46:11 +0100 Message-ID: Subject: Re: Clarification of behaviour when dropping partitions To: Laurenz Albe Cc: pgsql-general@postgresql.org Content-Type: multipart/alternative; boundary="000000000000b1d34f0628f8f4a4" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000b1d34f0628f8f4a4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Yes, right. I wonder if the team sees an opportunity for some optimization here, supporting such a scenario efficiently. I can't think of any downsides to it but I may be missing something. Cheers. On Thu, Dec 5, 2024 at 2:38=E2=80=AFAM Laurenz Albe wrote: > On Wed, 2024-12-04 at 23:00 +0100, Bolaji Wahab wrote: > > On Wed, Dec 4, 2024 at 6:20=E2=80=AFPM Laurenz Albe > wrote: > > > On Wed, 2024-12-04 at 14:22 +0100, Bolaji Wahab wrote: > > > > I have these two partitioned tables, with referential integrity. Th= e > tables > > > > are structured in such a way that we have 1 to 1 mapping between > their > > > > partitions. This is achieved with a foreign key. > > > > > > I recommend that you don't create the foreign key constraint between > the > > > partitioned tables, but between the individual partitions. > > > > > > That will make detaching and dropping partitions easier, and you will > have > > > the same integrity guarantees. > > > > Yes, this is what I have done. > > But the whole point of declaring the foreign key constraint on the > partitioned > > table is to have it automatically created on subsequent/future > partitions. > > Sure, but then you have to accept the disadvantage that it becomes more > difficult to detach partitions. I think it is less pain to create the > constraint on the partition level. > > Yours, > Laurenz Albe > --000000000000b1d34f0628f8f4a4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Yes, right. I wonder if the team sees=C2=A0an opportu= nity=C2=A0for some optimization here,=C2=A0supporting such a scenario effic= iently. I can't think of any downsides to it but I may be missing=C2=A0= something.

Cheers.

--000000000000b1d34f0628f8f4a4--