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 1vC24h-008AHg-Kl for pgsql-performance@arkaria.postgresql.org; Thu, 23 Oct 2025 20:38:19 +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 1vC24f-00Bgaw-Te for pgsql-performance@arkaria.postgresql.org; Thu, 23 Oct 2025 20:38:16 +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 1vC24f-00Bgae-IC for pgsql-performance@lists.postgresql.org; Thu, 23 Oct 2025 20:38:16 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vC24c-003rvd-0W for pgsql-performance@lists.postgresql.org; Thu, 23 Oct 2025 20:38:16 +0000 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-592f1988a2dso2082118e87.0 for ; Thu, 23 Oct 2025 13:38:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1761251893; x=1761856693; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=11/sVKd/Qd0nezG6dcJ47lI2DOTC9+zrE+FYxMbLlUA=; b=Jm9twh40sdj5CDh04lGtGPFErYzco83aZeUdE9z1Ootb15id/S2b0qP7ENfNFMJh8z S6P2AIfzSML+C6hb64H1vGQNOdoKZYcQ4YGBshevcQBQo3w0rzZXKktHw/OuAuSmT+06 /MgI06qq+dfv8NyG/mr6irPIdFjSxX5fcDQ6TfISLU/WdIbRqdz6gtrea8PjaCwjZSjx klFfPJggsFNEiRU+q7xnl+iFYgmhrUEXT1+t34wed/ZpEhM1S+lswspuQwmmuEffpXFu 0XcDZVv0Zkqra17H3LpPM2mUDzUqLfS435lQhA7wEiJZU7+vYeY391XIx07yKRtdxayn a2tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761251893; x=1761856693; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=11/sVKd/Qd0nezG6dcJ47lI2DOTC9+zrE+FYxMbLlUA=; b=Cv/k8iTbTb0nVCumTH84Q+MtzqvldruUVeEiMPTIAWH9FOo8ATFWywL6ECJ3qmqVP2 oJEjIWOY2fOMfNUqcXxul7UczgGwVV2gDEIsfIw/3/GeXL4X1zi2onIPJ3asYzn2osoj iiTsSgEOHgVZcAD1cxlhpzhQElv9F3lMcePlGi5yg0UFl7dXoUf1BIUTyOA3oozPW2pW MrOiFuqllcqO2QWYLvbPzjH89wkadFduYfMPoMYATX/J00YDQ8PbPTewHrczORWKQd1c PMvi9YufMdneP9/l18DQxK/n2jctvwjD7ez2Hk+WsOPi6iyObGJxTRD0sqFQ33rdEZdx jPMg== X-Forwarded-Encrypted: i=1; AJvYcCW0dcgu/x6Y+hD0Sz/cXGuPLxe1vrTrTYsskgo8k4JmjL2nRWabsewviPVknqlBNhcqkzwoKRli2JM9+Sf+DlDlmg==@lists.postgresql.org X-Gm-Message-State: AOJu0Yy3rD49t2SoQvK6RorKdsNATK6cYOtm4hKBnXy0inve5DA+wl3o ghdERoU6fKUEMbheQ9qIIPatr0edkDyNwdf1G/2QgE2BVq5uFjEJvoVMi7qdiWXoc5E= X-Gm-Gg: ASbGncum5Nqy2n7ty/IpwTELVDHwW6prf2bvJTmK8yS3oHdkUdVe4V7mveS4+F4yLn7 6rUlelHMt4g+KHcKONNk3rb/9Ka04GzpoZMgwRijzB00AS6PH9fb92ZO7vxcemYwfuwZakuNpdq WLdsJeH2S8H2IFd0I20Jc3t9dlVAwZC04AkDLawhg+GNVT/UWyBogBDRMYUG2uBZocNNTOoL/Ek xbMYtki2KOI3ZGNK7LIwQzU/aOXWcz6cA/DGjlS2gB3Wv2ESO9A4bdT7cZZ/mGt8u7Wfy0uNlbc bA1+0Tl7o1OryUYzG6RUmRSAkLYg4IOFjyT9TXLfFrhB0f4yx+1pb+pZT44EtBuFJ8sVvjcJC3a 8l4KnPHMRUcnPflVJDj+MAhzeg9aAbfIpnJXjATdn+Hgr3rUTuebStIDpABuPbmZBoW9TqMCc2S 1NfmDgUZFZCjR7TI0KTSAs38diYkuslps= X-Google-Smtp-Source: AGHT+IHUJQyqAV+DIfXz4+9sOXha2qrNWPw7lA1VBk8q7iZ/ODXIwbKe94M4ET+abJdvNmXku8k4jg== X-Received: by 2002:a05:6512:2c0a:b0:592:f6eb:8d58 with SMTP id 2adb3069b0e04-592fc0b1c7emr94839e87.8.1761251892670; Thu, 23 Oct 2025 13:38:12 -0700 (PDT) Received: from laurenz.albe-K4N0CV00F97414D ([159.148.223.130]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-592f4adebaesm990181e87.22.2025.10.23.13.38.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Oct 2025 13:38:12 -0700 (PDT) Message-ID: Subject: Re: Performance implications of partitioning by UUIDv7 range in PostgreSQL v18 From: Laurenz Albe To: Jonathan Reis , Greg Sabino Mullane Cc: Olof Salberger , pgsql-performance@lists.postgresql.org Date: Thu, 23 Oct 2025 23:38:11 +0300 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2 (3.56.2-2.fc42) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2025-10-23 at 13:11 -0700, Jonathan Reis wrote: > Thank you very much for your recommendations and your sample code. I orig= inally had it your way, but then I found out this is not possible >=20 > create table message ( > =C2=A0 id uuid PRIMARY KEY > =C2=A0 -- ... plus other columns > ) partition by range (uuid_extract_timestamp(id)); That's because you want to make "id" a primary key, but you can only create= a primary key constraint on a partitioned table if the partitioning key is a subset o= f the primary key. I recommend that you create a primary key on each partition rather than hav= ing one on the partitioned table. Yours, Laurenz Albe