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 1jXAzU-0005Qe-MM for pgsql-general@arkaria.postgresql.org; Fri, 08 May 2020 21:57:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jXAzT-0000T5-Jq for pgsql-general@arkaria.postgresql.org; Fri, 08 May 2020 21:57:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jXAzT-0000Sf-1B for pgsql-general@lists.postgresql.org; Fri, 08 May 2020 21:57:07 +0000 Received: from mail-il1-x143.google.com ([2607:f8b0:4864:20::143]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jXAzQ-0004Od-5S for pgsql-general@postgresql.org; Fri, 08 May 2020 21:57:06 +0000 Received: by mail-il1-x143.google.com with SMTP id m5so2800614ilj.10 for ; Fri, 08 May 2020 14:57:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=XyLzfeO17K9ard2dXGsBfNt5tRwtImGLfkfcBmeiQPo=; b=eh3hE97cpOhQLrmKSpTh2T0RmOFhJ//It3DF4DQP/lfEi2/DxRjGgRXeJ54COAv2T0 zkqE67AG/kzP0D8j1J+ahJp/C21YW3N4SIGnTtfqwOAoNDINlzDLbpqJPlkrMoXcPLSm 6ouPedhVqyLlMyBk/Q4ZWiJWyL3G11KR7kg99aEBiK/fKWEQcaHXpQF0xTpVAF3Sjdpf zdSEKr8Es6diuauPZXQEGhZMyUSspEkja0ZpaBcz68RrOwjhpVeG2ec2+nKgz5ddiJW1 Z4AFqdr+gy6E1XSPiGLiQE90NMoNPQm1Y+2nk5aKTbwcGXcUy2qi72LdXbqWmkBSEnsP /pQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=XyLzfeO17K9ard2dXGsBfNt5tRwtImGLfkfcBmeiQPo=; b=Xyuy79A4+AldTpPgFhNqZAm3GhfnA1Z+9OsLbpx8E4TKS1PJ79E6qwlockAaxrJKL9 cDeEqARFmtrrLgxFyvbeo3AAkDFT6Pq7PMLT/mI7gQv845oR1rDsv1zJjvB2P56m3hxZ BQLIHBSD9dfip1UiJe4Df93uRaiF65oMMgX2ytP19eIF7t+GANx3HQVY59v3gmeWAVft R1xQigof/bIImKdXiUA7gIhj/s/QmNJ5oxqQgvG3pNoHmyV+pz6ISOuOI45KMHeRw8dD ZcgP2gnzGyHoP4VqVf2FJg/yhnOv2q8D/1r5QFM8xciuluSBBNMiXZcue569fvFV2hLq eLgA== X-Gm-Message-State: AGi0PuaUnZnLqN5isZ4gpOllH4PJ9qPpSIp9l28x+VgRT5gnfNa5q+lJ epvPVp1bvYrFvKL6HI//rko= X-Google-Smtp-Source: APiQypIiCXNBmzZgBGfIcabT6Fjw704FHY4RWI9Svye6Pg2oqAbOaK3SXC+1C7LreUl+4QlH8b7Irw== X-Received: by 2002:a92:8f49:: with SMTP id j70mr4954908ild.117.1588975023321; Fri, 08 May 2020 14:57:03 -0700 (PDT) Received: from ?IPv6:2601:681:5500:dde0:13f:ef9:c6d0:c102? ([2601:681:5500:dde0:13f:ef9:c6d0:c102]) by smtp.gmail.com with ESMTPSA id t1sm1358501iln.4.2020.05.08.14.57.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 May 2020 14:57:02 -0700 (PDT) From: Rob Sargent Message-Id: <4C1FD415-F692-4341-A761-EAD1603DA53E@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_15635D3C-C8F2-4768-8F8F-33BC0B772D46" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: Thoughts on how to avoid a massive integer update. Date: Fri, 8 May 2020 15:57:01 -0600 In-Reply-To: Cc: "David G. Johnston" , "pgsql-general@postgresql.org" To: "Fehrle, Brian" References: <129e882d-fe4c-0ce9-1966-acbcbf94c309@aklaver.com> <0F5992D4-9317-4007-9036-202DC89BA0D8@comscore.com> <8491BCF6-2163-4765-BCCF-E96B845D7427@comscore.com> <8FA70C91-57D3-4AD6-9780-48AD0728CF3C@gmail.com> <7171C32C-B8BC-4721-9938-8F6BA4E38BC7@gmail.com> <99D056C8-343D-4823-9C8A-F9C06AD0D926@gmail.com> <502F77EC-9CEB-4DB6-91D6-3A30F704CF42@gmail.com> X-Mailer: Apple Mail (2.3608.80.23.2.2) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_15635D3C-C8F2-4768-8F8F-33BC0B772D46 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On May 8, 2020, at 3:52 PM, Fehrle, Brian = wrote: >=20 > David=E2=80=99s assessment is correct (and I think we=E2=80=99re 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=E2=80=99t set up that way from the beginning = (over a decade ago), this is what I=E2=80=99m stuck with. > =20 > Blah. >=20 Uncle. And you=E2=80=99re 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 ;) > =20 > From: Rob Sargent > > Date: Friday, May 8, 2020 at 3:05 PM > To: "David G. Johnston" > > Cc: "Fehrle, Brian" >, "pgsql-general@postgresql.org = " > > Subject: Re: Thoughts on how to avoid a massive integer update. > =20 > [External Email] >=20 > =20 >=20 >=20 >> On May 8, 2020, at 2:57 PM, David G. Johnston = > wrote: >> =20 >> On Fri, May 8, 2020 at 1:51 PM Rob Sargent > wrote: >>> =20 >>>> On May 8, 2020, at 2:43 PM, David G. Johnston = > wrote: >>>> =20 >>>> On Fri, May 8, 2020 at 1:41 PM Rob Sargent > 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?=20 >>>> =20 >>>> 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. >>>> =20 >>>=20 >>> Wow, I couldn=E2=80=99t disagree more ;) >> =20 >> 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. >> =20 >> David J. >=20 > =20 > Sorry, I wasn=E2=80=99t disagreeing with the problem statement. OP did = say the =E2=80=9Cinfo.id = =E2=80=9D needed to change from = 123 to 456. With the current foreign key alignment that is very = expensive. I think we=E2=80=99re all in agreement there. To push = =E2=80=9C456=E2=80=9D back out to the data table I see as perpetuation = of the problem. I didn=E2=80=99t sense that OP felt it necessary to = continue in the current mode as a requirement. If so, my mistake > =20 --Apple-Mail=_15635D3C-C8F2-4768-8F8F-33BC0B772D46 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On May 8, 2020, at 3:52 PM, Fehrle, Brian <bfehrle@comscore.com> wrote:

David=E2=80=99s assessment is correct = (and I think we=E2=80=99re 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=E2=80=99t set up that way from the beginning (over a decade ago), = this is what I=E2=80=99m stuck with.
 
Blah.


Uncle.

And you=E2=80=99= 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>
Date: Friday, May 8, 2020 at = 3:05 PM
To: "David G. Johnston" = <david.g.johnston@gmail.com>
Cc: "Fehrle, Brian" <bfehrle@comscore.com>, = "pgsql-general@postgresql.org" = <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> wrote:
 
On= Fri, May 8, 2020 at 1:51 PM Rob Sargent <robjsargent@gmail.com> = wrote:
 
On May 8, 2020, at 2:43 PM, David G. Johnston <david.g.johnston@gmail.com> wrote:
 
On= Fri, May 8, 2020 at 1:41 PM Rob Sargent <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.
 
<= /div>
Wow, I = couldn=E2=80=99t 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.
<= /div>
 
Sorry, I wasn=E2=80=99t disagreeing with the problem = statement. OP did say the =E2=80=9Cinfo.id=E2=80=9D = needed to change from 123 to 456.  With the current foreign key = alignment that is very expensive.  I think we=E2=80=99re all in = agreement there.  To push =E2=80=9C456=E2=80=9D back out to the = data table I see as perpetuation of the problem.  I didn=E2=80=99t = sense that OP felt it necessary to continue in the current mode as a = requirement.  If so, my mistake
 
= --Apple-Mail=_15635D3C-C8F2-4768-8F8F-33BC0B772D46--