pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rob Sargent <robjsargent@gmail.com>
To: Fehrle, Brian <bfehrle@comscore.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: Thoughts on how to avoid a massive integer update.
Date: Fri, 8 May 2020 15:57:01 -0600
Message-ID: <4C1FD415-F692-4341-A761-EAD1603DA53E@gmail.com> (raw)
In-Reply-To: <E1EDDEBA-D6C9-4C7D-AC66-6C48A15FE9E2@comscore.com>
References: <C7D3EE42-66B9-44AF-83F4-CB7F0F42486E@comscore.com>
	<129e882d-fe4c-0ce9-1966-acbcbf94c309@aklaver.com>
	<0F5992D4-9317-4007-9036-202DC89BA0D8@comscore.com>
	<E3B6D3D1-D60E-40D9-8855-B23F7EDBFA8E@gmail.com>
	<8491BCF6-2163-4765-BCCF-E96B845D7427@comscore.com>
	<8FA70C91-57D3-4AD6-9780-48AD0728CF3C@gmail.com>
	<CAKFQuwYh5qfo752TxAu6SrwXB5zAd-N_p00CKJZ8+fKm0WsWAw@mail.gmail.com>
	<7171C32C-B8BC-4721-9938-8F6BA4E38BC7@gmail.com>
	<CAKFQuwYkvURpOY+pJSX53kEfmx6-xzJpLYdT9Au0Ppf3_Q34Wg@mail.gmail.com>
	<99D056C8-343D-4823-9C8A-F9C06AD0D926@gmail.com>
	<CAKFQuwbeTJitNUMasKtjTopbs-bcVurvPVth9oTACGRVKhCKAg@mail.gmail.com>
	<502F77EC-9CEB-4DB6-91D6-3A30F704CF42@gmail.com>
	<E1EDDEBA-D6C9-4C7D-AC66-6C48A15FE9E2@comscore.com>



> On May 8, 2020, at 3:52 PM, Fehrle, Brian <bfehrle@comscore.com> wrote:
> 
> David’s assessment is correct (and I think we’re all on the same page). The value of the foreign keys that tie the tables together must be changed, and yeah that value _should_ simply be an additional column in the info_table and the foreign key be an arbitrary integer, but since it wasn’t set up that way from the beginning (over a decade ago), this is what I’m stuck with.
>  
> Blah.
> 

Uncle.

And you’re stuck with it because no-one joins back to info, I take it?  Denormalization writ large.  Oh heck do the switcheroo and mail out a magic decoder ring ;)

>  
> From: Rob Sargent <robjsargent@gmail.com <mailto:robjsargent@gmail.com>>
> Date: Friday, May 8, 2020 at 3:05 PM
> To: "David G. Johnston" <david.g.johnston@gmail.com <mailto:david.g.johnston@gmail.com>>
> Cc: "Fehrle, Brian" <bfehrle@comscore.com <mailto:bfehrle@comscore.com>>, "pgsql-general@postgresql.org <mailto:pgsql-general@postgresql.org>" <pgsql-general@postgresql.org <mailto:pgsql-general@postgresql.org>>
> Subject: Re: Thoughts on how to avoid a massive integer update.
>  
> [External Email]
> 
>  
> 
> 
>> On May 8, 2020, at 2:57 PM, David G. Johnston <david.g.johnston@gmail.com <mailto:david.g.johnston@gmail.com>> wrote:
>>  
>> On Fri, May 8, 2020 at 1:51 PM Rob Sargent <robjsargent@gmail.com <mailto:robjsargent@gmail.com>> wrote:
>>>  
>>>> On May 8, 2020, at 2:43 PM, David G. Johnston <david.g.johnston@gmail.com <mailto:david.g.johnston@gmail.com>> wrote:
>>>>  
>>>> On Fri, May 8, 2020 at 1:41 PM Rob Sargent <robjsargent@gmail.com <mailto:robjsargent@gmail.com>> wrote:
>>>>> My understanding is the keys in the info_table need to change.  That causes the very expensive update in the update in the data tables. No? 
>>>>  
>>>> The keys in the info_table need to change because their contents are no longer legal to be stored (OP has not specified but think using an integer value of someones social security number as a key).  The FK side of the relationship equality has the same illegal data values problem and need to be changed too.
>>>>  
>>> 
>>> Wow, I couldn’t disagree more ;)
>>  
>> Your agreement or disagreement with the problem statement is immaterial here - the OP has stated what the requirement, for which I have made a simplistic analogy in order to try and get the point across to you.  As the OP has said it is a poor design - and now it is being corrected.  The request is whether there is some way to do so better than the two options the OP already described.
>>  
>> David J.
> 
>  
> Sorry, I wasn’t disagreeing with the problem statement. OP did say the “info.id <https://linkprotect.cudasvc.com/url?a=http%3a%2f%2finfo.id&c=E,1,l7B8bw8isNYaTDkm2_hIVb79FGTulxe... needed to change from 123 to 456.  With the current foreign key alignment that is very expensive.  I think we’re all in agreement there.  To push “456” back out to the data table I see as perpetuation of the problem.  I didn’t sense that OP felt it necessary to continue in the current mode as a requirement.  If so, my mistake
>  

view thread (19+ messages)

Message-ID: <4C1FD415-F692-4341-A761-EAD1603DA53E@gmail.com>
Permalink:  ../4C1FD415-F692-4341-A761-EAD1603DA53E@gmail.com/
Also on:    postgresql.org/message-id/4C1FD415-F692-4341-A761-EAD1603DA53E@gmail.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: robjsargent@gmail.com, bfehrle@comscore.com, david.g.johnston@gmail.com
  Subject: Re: Thoughts on how to avoid a massive integer update.
  In-Reply-To: <4C1FD415-F692-4341-A761-EAD1603DA53E@gmail.com>
  References: <C7D3EE42-66B9-44AF-83F4-CB7F0F42486E@comscore.com> <129e882d-fe4c-0ce9-1966-acbcbf94c309@aklaver.com> <0F5992D4-9317-4007-9036-202DC89BA0D8@comscore.com> <E3B6D3D1-D60E-40D9-8855-B23F7EDBFA8E@gmail.com> <8491BCF6-2163-4765-BCCF-E96B845D7427@comscore.com> <8FA70C91-57D3-4AD6-9780-48AD0728CF3C@gmail.com> <CAKFQuwYh5qfo752TxAu6SrwXB5zAd-N_p00CKJZ8+fKm0WsWAw@mail.gmail.com> <7171C32C-B8BC-4721-9938-8F6BA4E38BC7@gmail.com> <CAKFQuwYkvURpOY+pJSX53kEfmx6-xzJpLYdT9Au0Ppf3_Q34Wg@mail.gmail.com> <99D056C8-343D-4823-9C8A-F9C06AD0D926@gmail.com> <CAKFQuwbeTJitNUMasKtjTopbs-bcVurvPVth9oTACGRVKhCKAg@mail.gmail.com> <502F77EC-9CEB-4DB6-91D6-3A30F704CF42@gmail.com> <E1EDDEBA-D6C9-4C7D-AC66-6C48A15FE9E2@comscore.com> <4C1FD415-F692-4341-A761-EAD1603DA53E@gmail.com>

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

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