public inbox for [email protected]  
help / color / mirror / Atom feed
From: Adrian Klaver <[email protected]>
To: mark bradley <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: Duplicate Key Values
Date: Tue, 11 Mar 2025 09:00:27 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <SJ2PR22MB4328A3EDC83E495DB9A4BD09BAD12@SJ2PR22MB4328.namprd22.prod.outlook.com>
References: <CH3PR22MB4312C23476C0E67F9B4C2E10BACB2@CH3PR22MB4312.namprd22.prod.outlook.com>
	<SJ2PR22MB4328C88FCBA2B447CC72DC90BACA2@SJ2PR22MB4328.namprd22.prod.outlook.com>
	<[email protected]>
	<SJ2PR22MB4328931B7CB951A48F1434ABBACA2@SJ2PR22MB4328.namprd22.prod.outlook.com>
	<[email protected]>
	<SJ2PR22MB43286857EAC74D1EE332B08CBAD52@SJ2PR22MB4328.namprd22.prod.outlook.com>
	<[email protected]>
	<SJ2PR22MB43282F7C60DD81CA90502FA0BAD52@SJ2PR22MB4328.namprd22.prod.outlook.com>
	<[email protected]>
	<SJ2PR22MB4328C3D2704FB8F6CD079924BAD12@SJ2PR22MB4328.namprd22.prod.outlook.com>
	<[email protected]>
	<SJ2PR22MB4328267BD9F601D90601715BBAD12@SJ2PR22MB4328.namprd22.prod.outlook.com>
	<[email protected]>
	<SJ2PR22MB4328A3EDC83E495DB9A4BD09BAD12@SJ2PR22MB4328.namprd22.prod.outlook.com>

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 <https://amazon.com/author/markjbrady>_
> ------------------------------------------------------------------------
> *From:* Adrian Klaver <[email protected]>
> *Sent:* Tuesday, March 11, 2025 11:12 AM
> *To:* mark bradley <[email protected]>
> *Cc:* pgsql-general <[email protected]>
> *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 <https://amazon.com/author/markjbrady 
> <https://amazon.com/author/markjbrady>>_
>> ------------------------------------------------------------------------
>> *From:* Adrian Klaver <[email protected]>
>> *Sent:* Tuesday, March 11, 2025 10:56 AM
>> *To:* mark bradley <[email protected]>
>> *Cc:* pgsql-general <[email protected]>
>> *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 <https://amazon.com/author/markjbrady
>> <https://amazon.com/author/markjbrady 
> <https://amazon.com/author/markjbrady>>>_
>> 
>> 
>> -- 
>> Adrian Klaver
>> [email protected]
>> 
> 
> -- 
> Adrian Klaver
> [email protected]
> 

-- 
Adrian Klaver
[email protected]







view thread (25+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Duplicate Key Values
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox