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 1vCJfb-00C0zL-6V for pgsql-performance@arkaria.postgresql.org; Fri, 24 Oct 2025 15:25:34 +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 1vCJfZ-00HXr8-NW for pgsql-performance@arkaria.postgresql.org; Fri, 24 Oct 2025 15:25:32 +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 1vCJfZ-00HXqy-1K for pgsql-performance@lists.postgresql.org; Fri, 24 Oct 2025 15:25:32 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vCJfV-00413u-2T for pgsql-performance@lists.postgresql.org; Fri, 24 Oct 2025 15:25:31 +0000 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-7a2852819a8so892008b3a.3 for ; Fri, 24 Oct 2025 08:25:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=conevity-com.20230601.gappssmtp.com; s=20230601; t=1761319526; x=1761924326; darn=lists.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=bRrzCQkTFqIknjrm+cjRvEAEqACXw1wjDprjBIpKWGY=; b=MUDHLR7v/1krvD6OM0lIVIXIrlnp9TwLGceFLUxjOknlSO8AZN/dVtcOooI17jPnUY hUGKkuWrQe1HfaA88vb10Q7tzcUQmdTRulMCpVQGgAIPlFGkCwnC3O6eZ64NxBgUFYR7 Oo1f6Zio9V1AIMBEHfeKxaqVb1iV4J2lboisL60tv2825StYPRCjVS76OXnwGY9E9fTA H3tqcUvy+jxDVMWbiXjTpfUdsjoLiAkXjv6JzVxmOg8wwE77KP32iP//y701Cll/RRWs g8BN7bHJs5uLfv/1BMBPvudE0pe93mQ/6TNA2hYEg2aKtToHahM/iTYNjw6Gv5BuDD8S u4Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761319526; x=1761924326; 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=bRrzCQkTFqIknjrm+cjRvEAEqACXw1wjDprjBIpKWGY=; b=QwI1hmatAHBiirJBlkUeowEY9DuH/+AYZXL3DQ34V/T6b7LS0YEiPIFaFw0UWullgp sFbKnhXp/1xAywnVrp5CQdqrSNXvpJXMgsL7cVC+TzV4dPkVCyzXS3FAHSt2VXjyEZK5 gRGmlDYUewzvE0qJ4HbAMYhoom2yh0Rin07fKuWr6M7cMwW48M1cPArWZ0OXz6Slo+RY XGGqF7fEM8iNaduw7OQ/9tYLKegPATLYZFqA0rIuutcf4qR72sUNDV3xNGs0P0Gzl34O TbijXkRoYuBQhIryks2uwstphQn28zKv9j4PfCyk5H0xXeyM+5e8am5tZ1mZhjYGTZb6 7EgQ== X-Forwarded-Encrypted: i=1; AJvYcCWcYF7FhcJptO2p8xIlubSj3FX2uQ5mNw6Q5qXhUSTfNv6O4UXueXDXXlearV0+Z0h4GUwj2rb2UcQmhrdCkEnghg==@lists.postgresql.org X-Gm-Message-State: AOJu0Yx0nxYKkK2asvP3Bo2CbH+j3S3W4SZmQmHySenYjVPAhmVJng+s jKIStE48oglCfPwelX7sJ01xZXWCu3H4RwmbGxrn940K/sUHxhFRB0OUzl3ILE3P0IOb/ghNNy7 Qzxy42SA= X-Gm-Gg: ASbGncsI39muX2l06EJo6QpNrCgUXXUTJYUkxF2RY+3PKoLuTB0BT+j6eO4dBuIJ05z 7O3bBM49CD2Z9Zfziv+bRYpfVVgw1o3VhbI2Xv+9xcJEVPGkV2H5hXDDNBKlmdn2opVAC0fPkIc qX5ywwS+3SujK2RA67lST9AAp4hEaJzDPwD8HZpfzfFT/cHflnHX38JeG3/oJKGaAMG94IoIaMp dCw+RIeqNL0B9hOk+Oi/emaU8ZjeavrWMQZnnpNnUzTzUZTb3e32hhnyudY36Q8YVPSd8SKEr+M ouRnRkMGE7nv4v2YdtFi4XwcBGUSF2KJLWO3n4yVAkyDx3vduGm5b9d3zCrfonPylCaNjXftLHl eXEKo6vTS/F3XyAC8XI6ZcMYKtWtc3rsQLY9RJgr7Df8nTmDjwUrQmJ78egMod4l8+ndORH0b6T 9L59xV7mgD3s00+yO6oRBh4khSAoqFr+4oZJREHK637eg= X-Google-Smtp-Source: AGHT+IESOpScVM2UpY/Jgs6p5x1VRdqBTOYiRF1Ng6Nt3X4oAUPpUuEDnhSYeiV4934h+Ny4CVGzmg== X-Received: by 2002:a05:6a20:430b:b0:334:9c05:f744 with SMTP id adf61e73a8af0-33c5fbaad8amr8392560637.12.1761319526136; Fri, 24 Oct 2025 08:25:26 -0700 (PDT) Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com. [209.85.215.181]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7a274a64c0asm6329545b3a.4.2025.10.24.08.25.25 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Oct 2025 08:25:25 -0700 (PDT) Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-b5579235200so1581002a12.3 for ; Fri, 24 Oct 2025 08:25:25 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCXGPkPnk/J5FMyNbpJJB+CuQ6qR0G88/dQDYZdNdmrPck6EQz+BHNNj4od7NalHbCRY1qt/IknhVqzYMGiEZhhTuw==@lists.postgresql.org X-Received: by 2002:a17:903:2446:b0:26a:f6e6:ef4f with SMTP id d9443c01a7336-2946e29d5c3mr70157355ad.60.1761319524938; Fri, 24 Oct 2025 08:25:24 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Reis Date: Fri, 24 Oct 2025 08:24:46 -0700 X-Gmail-Original-Message-ID: X-Gm-Features: AS18NWDp2SzXOy7FfsMY_R_c8T1FB6ta9b6a3DiOME47gRoRxy9LcmlOpxCDXd0 Message-ID: Subject: Re: Performance implications of partitioning by UUIDv7 range in PostgreSQL v18 To: Laurenz Albe Cc: David Rowley , Greg Sabino Mullane , Olof Salberger , pgsql-performance@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000009eb8d10641e928db" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000009eb8d10641e928db Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Great point. One of the main reasons we are using partitioning is to quickly drop partitions containing old data so we wouldn't be implementing foreign key constraints any way. On Thu, Oct 23, 2025 at 10:04=E2=80=AFPM Laurenz Albe wrote: > On Fri, 2025-10-24 at 11:54 +1300, David Rowley wrote: > > On Fri, 24 Oct 2025 at 09:38, Laurenz Albe > wrote: > > > I recommend that you create a primary key on each partition rather > than having one > > > on the partitioned table. > > > > It might be worth mentioning that doing that would forego having the > > ability to reference the partitioned table in a foreign key > > constraint. > > Right, but referencing a partitioned table with a foreign key is a mixed > blessing > anyway: you could no longer drop partitions from the partitioned table > without > scanning the referencing table to verify that the foreign key is not > violated. > > Yours, > Laurenz Albe > --0000000000009eb8d10641e928db Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Great point. One of the main = reasons we are using partitioning is to quickly drop partitions containing = old data so we wouldn't be implementing foreign key constraints any way= .

On Thu, Oct 23, 2025 at 10:04=E2=80=AFPM Laur= enz Albe <laurenz.albe@cyber= tec.at> wrote:
On Fri, 2025-10-24 at 11:54 +1300, David Rowley wrote:
> On Fri, 24 Oct 2025 at 09:38, Laurenz Albe <laurenz.albe@cybertec.at> wro= te:
> > I recommend that you create a primary key on each partition rathe= r than having one
> > on the partitioned table.
>
> It might be worth mentioning that doing that would forego having the > ability to reference the partitioned table in a foreign key
> constraint.

Right, but referencing a partitioned table with a foreign key is a mixed bl= essing
anyway: you could no longer drop partitions from the partitioned table with= out
scanning the referencing table to verify that the foreign key is not violat= ed.

Yours,
Laurenz Albe
--0000000000009eb8d10641e928db--