Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m49nT-0000uG-Py for pgsql-admin@arkaria.postgresql.org; Thu, 15 Jul 2021 22:25:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m49nS-00078A-BL for pgsql-admin@arkaria.postgresql.org; Thu, 15 Jul 2021 22:25:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m49nR-00077y-Ak for pgsql-admin@lists.postgresql.org; Thu, 15 Jul 2021 22:25:34 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m49nN-0001aM-W2 for pgsql-admin@lists.postgresql.org; Thu, 15 Jul 2021 22:25:33 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 056593200924; Thu, 15 Jul 2021 18:25:26 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 15 Jul 2021 18:25:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=kyxbS1A8lgL1hqqtvqxRC+wZpfitpl4pDbihxdTnH4o=; b=PDNTfp+E /uyPHAznOSakziJA97ZYMHLhQUGM9oYAnfKAA0Fdab9BDwveIbgmJDgsk8BZ0qIs 0xVYOPODH1Mqp6tOuGzutpp4sLP4/ofOtWHrd7EuVmAGV7qBW8jp9rww4EI7qlm3 fL/z69Ab5UaPdBGPW3noPHPMCSPihxr64yvReOPlMTQAs7QrhFubZ2P3zPf3ZaUg 799iCQ0WgKPZJPNPWlP4xcksBmZErQVSUNF1BNnxO3u1dToySrVwChs87Bawa1C/ Utsou4RBB33pCL8P9rAtxGPrkk4VjizgvpVpizY3tXqjZbRENGYD00AV9EvHipZe isjmb3iVybLhog== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddvgddthecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgheqne cuggftrfgrthhtvghrnhepudejveejffejveduudetvdekieeuiedtvdeileefkeevjedu feeguedvjefhueelnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomhenuc evlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgv rhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 15 Jul 2021 18:25:25 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id E37862A099B; Thu, 15 Jul 2021 18:25:21 -0400 (-04) Date: Thu, 15 Jul 2021 18:25:21 -0400 From: Alvaro Herrera To: Wells Oliver Cc: Ron , pgsql-admin@lists.postgresql.org Subject: Re: Partitioning on the date part of a timestamp & PK issues Message-ID: <202107152225.tpa2eqvotze7@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021-Jul-15, Wells Oliver wrote: > Correct me if I'm wrong, but wouldn't partitioning by just the ts column > create a ton of partitions per the granular nature of timestamps? Or do I > wildly misunderstand this? Another Very Large Table we have partitioned by > a date field cleanly creates monthly partitions. You decide the boundaries values of each partition. Dates are granular to days, yet you have created partitions cleanly on month boundaries. Same with timestamps. Nobody is forcing you to create one partition per microsecond. Anyway, I don't think what you want is possible. Your partition needs to be formed by columns that are in the primary key, and your primary key columns are already defined. You can partition by guid, or partition by tid, or partition by seq, or any combination thereof. You cannot partition by the date column. The error about expressions being unusable is just a forerunner. -- Álvaro Herrera 39°49'30"S 73°17'W — https://www.EnterpriseDB.com/