Re: Thoughts on how to avoid a massive integer update.

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "Fehrle, Brian" <bfehrle(at)comscore(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Thoughts on how to avoid a massive integer update.
Date: 2020-05-08 20:41:34
Message-ID: 7171C32C-B8BC-4721-9938-8F6BA4E38BC7@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On May 8, 2020, at 2:37 PM, David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
> On Fri, May 8, 2020 at 12:49 PM Rob Sargent <robjsargent(at)gmail(dot)com <mailto:robjsargent(at)gmail(dot)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 = info_table_sid;
>
> update info_table set info_table_sid = 456 where info_table_sid = 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?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Support 2020-05-08 20:42:04 Re: pg_basebackup cannot compress to STDOUNT
Previous Message David G. Johnston 2020-05-08 20:37:36 Re: Thoughts on how to avoid a massive integer update.