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 1ts220-00DVP6-Pu for pgsql-general@arkaria.postgresql.org; Tue, 11 Mar 2025 16:00:37 +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 1ts21y-001aGc-IZ for pgsql-general@arkaria.postgresql.org; Tue, 11 Mar 2025 16:00:34 +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 1ts21x-001aFH-OR for pgsql-general@lists.postgresql.org; Tue, 11 Mar 2025 16:00:34 +0000 Received: from fhigh-b6-smtp.messagingengine.com ([202.12.124.157]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ts21t-002GRz-0r for pgsql-general@postgresql.org; Tue, 11 Mar 2025 16:00:33 +0000 Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfhigh.stl.internal (Postfix) with ESMTP id 85F4C25400C7; Tue, 11 Mar 2025 12:00:28 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Tue, 11 Mar 2025 12:00:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1741708828; x=1741795228; bh=BwkvrHGL1GF1OvIiAmO75//BXZxrsOj8vFM6oHgNK84=; b= oUMFArSRnuZWPpVpb1GZw4b9o9Y1Dc5DvScfDLJN/P9q/zDK0QETEGvT50/6q0fd +1uvhGVHuYKW1er0wXLSvoJUUOcBILhyotrD3HcZw7ZRVXE72CCyMOHjKCyho7Py TGkNlz3KvqVsz6630gJ3V5An0Wzme5CkxslpmWuYsTCBVBkTOSYMZxK2DjJRoWyV BN4YNkKEgOXr6CAdRB4obUrvIE5koZ/ukTPs6ddNob9aI4WEP5H2uyK0VsoBIRwf xHGvJ7DHweYU1/zmYbEMfzv0qPN3setvyP+htYornxwp/tDKOOP+BY8jATlylpt1 iz1AqEHcsOpgjl7mtoyaRA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1741708828; x= 1741795228; bh=BwkvrHGL1GF1OvIiAmO75//BXZxrsOj8vFM6oHgNK84=; b=s 0jZK4EwowUSULkCvAa/iCquDZ3AiTJ0+76CVZQl49ahs18btCNtKle+Xm5yIkdcC 7vZRWR+gBHLf28qXcx+Bf0b1PWviQkm/bm8OPaR9vYnh1ySpgAhZ0lcGvNoQ8o/T pU8K9GOGDZ5wTcjUUKDFgsQ91SEDeC4w9G70dflYiI0JCMaNiJtrFVk7L6647jIl 31EILHMkxThVvyJuvvysO5Xna1kke+bfBPgyZxlnPy9vs6fe4vGcY4gSdO2pzOSd a5Rbnj+9DvyspsYkolqBAv5rrLS6NZlvL9FQGqaCCGPqI51vrXAPsIo11Ggg5U5i aAqYjpiitQIpIUOcdlyJw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduvddvieehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefkff ggfgfuvfevfhfhjggtgfesthekredttddvjeenucfhrhhomheptegurhhirghnucfmlhgr vhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmqeenucggtf frrghtthgvrhhnpeehvdeiffdvieetleejgeduieefhefhiedvffelueehveeutedugeff keehtdfgieenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgpdgprghmrgiioh hnrdgtohhmpdgrmhgriihonhdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgr rhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrd gtohhmpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthho pehmrghrkhgsrhgrugihjhhusehouhhtlhhoohhkrdgtohhmpdhrtghpthhtohepphhgsh hqlhdqghgvnhgvrhgrlhesphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 11 Mar 2025 12:00:27 -0400 (EDT) Message-ID: <84aac7bf-5638-4f1f-9772-ace0ea27e848@aklaver.com> Date: Tue, 11 Mar 2025 09:00:27 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Duplicate Key Values To: mark bradley Cc: pgsql-general References: <75b33741-ee99-4524-b63a-edad21c1266d@aklaver.com> <9d919848-3fe1-46fd-b343-c5f2931864f7@aklaver.com> <513ddbee-135c-4af2-b6f6-acca667b8d09@aklaver.com> Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/11/25 08:16, mark bradley wrote: A) 1) Please do not top post. Either inline or bottom post. It makes things like the below easier to follow. I wrote the post you responded to and it took me a bit to catch the b as a reference to: > b > b) Or for any node_ids that where duplicated did reindexing eliminate all rows with that node_id. B) From a previous post of yours: " 1. Originally, the key in the node table was a sequence, but I changed it to a non-sequence. 2. There is no index on the primary key node_id, and I understand there should be one. 3. I didn't explicitly use Postgres inheritance but there are two tables that are subclasses of node. There are dataset nodes and processing_node [s] tables. Each is a type of node and have primary keys that are foreign keys from the node table. This key is node_id. " As to point 2, from this message: https://www.postgresql.org/message-id/75b33741-ee99-4524-b63a-edad21c1266d%40aklaver.com there is an index on node_id as it is the Primary Key. Why do you think there is not? Can you elaborate more on point 3. Are you calling the Foreign Key relationships subclassing? C) > REINDEX TABLE node; > > Also reindexed table with node_id as a foreign key in the same way. Is there anything in Postgres log at the time you did the above that showed it did more then a REINDEX? > > > Best regards, > Mark Brady > _amazon.com/author/markjbrady _ > ------------------------------------------------------------------------ > *From:* Adrian Klaver > *Sent:* Tuesday, March 11, 2025 11:12 AM > *To:* mark bradley > *Cc:* pgsql-general > *Subject:* Re: Duplicate Key Values > On 3/11/25 08:05, mark bradley wrote: >> The rows that were preserved in the nodes table were the ones that were >> not dups originally. > > 1) To be specific: > > a) If there where two or more rows with a node_id, after the reindexing > was there only one left? > > b) Or for any node_ids that where duplicated did reindexing eliminate > all rows with that node_id. > > > 2) Per post from Greg Sabino Mullane, you need to show us the steps you > took to reindex the table. > >> >> >> Best regards, >> Mark Brady >> _amazon.com/author/markjbrady >_ >> ------------------------------------------------------------------------ >> *From:* Adrian Klaver >> *Sent:* Tuesday, March 11, 2025 10:56 AM >> *To:* mark bradley >> *Cc:* pgsql-general >> *Subject:* Re: Duplicate Key Values >> On 3/11/25 07:28, mark bradley wrote: >>> An "interesting" effect of reindexing is that all the records that were >>> dups in the nodes table were deleted, both copies. >> >> I am trying to understand above. >> >> Was there at least one row of each node_id left? >> >>> >>> Also, all rows having node_id as a foreign key in other tables were >>> deleted, which means all rows in these tables were deleted. >>> >>> Fortunately these are not huge tables.  I will reenter the data, make a >>> backup, and then try your further extended suggestions. >>> >>> Best regards, >>> Mark Brady >>> _amazon.com/author/markjbrady > >>_ >> >> >> -- >> Adrian Klaver >> adrian.klaver@aklaver.com >> > > -- > Adrian Klaver > adrian.klaver@aklaver.com > -- Adrian Klaver adrian.klaver@aklaver.com