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 1jX9oT-000357-Bw for pgsql-general@arkaria.postgresql.org; Fri, 08 May 2020 20:41:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jX9oS-0007N7-9b for pgsql-general@arkaria.postgresql.org; Fri, 08 May 2020 20:41:40 +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 1jX9oS-0007N0-1c for pgsql-general@lists.postgresql.org; Fri, 08 May 2020 20:41:40 +0000 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jX9oP-0002g6-QQ for pgsql-general@postgresql.org; Fri, 08 May 2020 20:41:39 +0000 Received: by mail-io1-xd29.google.com with SMTP id y26so3149929ioj.2 for ; Fri, 08 May 2020 13:41:37 -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=b5RmNBC+S1fdAwsrisu8CbbPjNY09S3YBOuz6W2iuU8=; b=lSYxhFbb3Als9x+nrM7K6nJWGNtDS0Iz6NmRn+61xZvQGFD2HrNlAkJ2tWYOC8EL6A bwZFEVyZhfRoCf60ne1zMFPZnA8ByjZhfWSexFccOvWUSoxw3sbiJB1VvMIhqbQEIjKn f0lPQ2Zf2bc1KxYZYZrf4KdZJq97CIe2WxpBhsEpiBOVbDIfoU9oyD7TogaMgnKTSodD u0rjH9iAqDL6IBcCMr1XsH/44OdX6BkV9GgCSSF4WjGEQ1qBznVl1fsImegz7zAaNZSm ps+dc7cV6xHq2kjtPzHIeavh16jr/ffHEeeXN1joT5hS+FGt+z5ZQ+LveM/co6BIblsp 4lEQ== 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=b5RmNBC+S1fdAwsrisu8CbbPjNY09S3YBOuz6W2iuU8=; b=dhz89yr45yNsZcUmlVbKSJjCcNdhLBKygNttcGX5pP/T9HzAKlTKP/DjwhoQkbHnwR MPcSqwf1gnD3weqT8wLLLorrURaxkloB0cpfWuEKtpo2ZCRQ588SY72wHrmccmUyp43P MYJVhGXOklxgIB2emk15YUyqFU3oJy5vrTLiLIQZb2csjeDStyn2bg0pimaJKJup/VAZ bZtY29q6zutvYitM8+bAch4wBpnLmjFp2xZ6iAM0B5DrhzeJSeOETOiO9Uombxi2e0zq 6r1U00vMRQhOik1g7H9tKqjNv4Z2h7xq3uqsrVhRdFoUgFKHuLFtPRTKptkHWKIs39F7 hFHQ== X-Gm-Message-State: AGi0PuanIt+BVA8IA96B2jxl9ZWIaNy8TZ5lCRJ1K0oIzED2mCBK/P8t 8unSIgc/pNKepUqP8yuxCVs= X-Google-Smtp-Source: APiQypK5EkQy119YOUAgF0gz3dxwM2pmVKhCATXW6IM4E/W6pt96NSHXSFJaNuQW9+B4rDx/DGt+YA== X-Received: by 2002:a6b:e009:: with SMTP id z9mr2820803iog.97.1588970496101; Fri, 08 May 2020 13:41:36 -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 i12sm1260542ill.73.2020.05.08.13.41.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 May 2020 13:41:35 -0700 (PDT) From: Rob Sargent Message-Id: <7171C32C-B8BC-4721-9938-8F6BA4E38BC7@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_A221D5C4-77B9-4264-9A3E-9044EEDCD0A9" 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 14:41:34 -0600 In-Reply-To: Cc: "Fehrle, Brian" , "pgsql-general@postgresql.org" To: "David G. Johnston" 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> 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=_A221D5C4-77B9-4264-9A3E-9044EEDCD0A9 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On May 8, 2020, at 2:37 PM, David G. Johnston = wrote: >=20 > On Fri, May 8, 2020 at 12:49 PM Rob Sargent > wrote: > Well as I said, I think you could add a column to info_table > alter table info_table add orig_id int; > update info_table set orig_id =3D info_table_sid; >=20 > update info_table set info_table_sid =3D 456 where info_table_sid =3D = 456;=20 > =20 > huh?=20 >=20 > alter table data_table drop reference NOT SQL > alter table data_table make reference to info_table.orig_id NOT SQL >=20 > You don't seem to understand the requirement. The data_table integer = value must be changed - all you are doing is a convoluted column rename = on the table holding the PK half of the relationship. >=20 > David J. >=20 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= --Apple-Mail=_A221D5C4-77B9-4264-9A3E-9044EEDCD0A9 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii

On May 8, 2020, at 2:37 PM, David G. Johnston <david.g.johnston@gmail.com> wrote:

On Fri, May = 8, 2020 at 12:49 PM Rob Sargent <robjsargent@gmail.com> wrote:
Well as I said, I think you could add a column = to info_table
alter table = info_table add orig_id int;
update info_table set = orig_id =3D info_table_sid;

update info_table set info_table_sid =3D 456 where = info_table_sid =3D 456; 
 
huh? 

alter table = data_table drop reference NOT SQL
alter table data_table make reference to = info_table.orig_id NOT SQL

You don't seem to = understand the requirement.  The data_table integer value must = be changed - all you are doing is a convoluted column rename on the = table holding the PK half of the relationship.

David J.

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? 



= --Apple-Mail=_A221D5C4-77B9-4264-9A3E-9044EEDCD0A9--