pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Mohamed Wael Khobalatte <mkhobalatte@grubhub.com>
To: Michael Lewis <mlewis@entrata.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Switching Primary Keys to BigInt
Date: Tue, 21 Jul 2020 16:32:40 -0700
Message-ID: <14e326d2-7ee3-be5a-feb5-4e6c43425fb8@aklaver.com> (raw)
In-Reply-To: <CABZeWdwsaMvjU7ECLKpAr5WZVp+5LS7NAcqhzg1KHkFHQQr1xQ@mail.gmail.com>
References: <CABZeWdybDVTgCQFZf0jDtj0p4yLxNrYd8aw61iFxY-Xt+fqPkw@mail.gmail.com>
	<CAHOFxGqa9gEH5rsmMc=0=jzQn_nLuWTNkdRLnkF4Jj6zXqM7ig@mail.gmail.com>
	<CABZeWdwsaMvjU7ECLKpAr5WZVp+5LS7NAcqhzg1KHkFHQQr1xQ@mail.gmail.com>

On 7/21/20 2:18 PM, Mohamed Wael Khobalatte wrote:
>>  > test_(aklaver)5432> alter table change_seq alter COLUMN id set data type
>> bigint;
>> ALTER TABLE
>> test_(aklaver)5432> \d change_seq
>>                              Table "public.change_seq"
>>   Column |  Type  | Collation | Nullable |                Default
>> --------+--------+-----------+----------+----------------------------------------
>>
>>   id     | bigint |           | not null |
>> nextval('change_seq_id_seq'::regclass)
>> Indexes:
>>      "change_seq_pkey" PRIMARY KEY, btree (id)
> 
> This is significant downtime, since it locks exclusively, no? We want to 
> avoid that.

Yeah, I thought the int --> bigint would not do a table rewrite. Testing 
showed otherwise. Forget that idea.

> 
>  > Side note- EOL for 9.6 is coming next year so just a plug for 
> upgrading when possible, perhaps utilizing pglogical to get to v11 or 12.
> 
> Yep, we are painfully aware. The id growth will beat us to it, so we 
> need to deal with that first.
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (17+ messages)  latest in thread

Message-ID: <14e326d2-7ee3-be5a-feb5-4e6c43425fb8@aklaver.com>
Permalink:  ../14e326d2-7ee3-be5a-feb5-4e6c43425fb8@aklaver.com/
Also on:    postgresql.org/message-id/14e326d2-7ee3-be5a-feb5-4e6c43425fb8@aklaver.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: adrian.klaver@aklaver.com, mkhobalatte@grubhub.com, mlewis@entrata.com
  Subject: Re: Switching Primary Keys to BigInt
  In-Reply-To: <14e326d2-7ee3-be5a-feb5-4e6c43425fb8@aklaver.com>
  References: <CABZeWdybDVTgCQFZf0jDtj0p4yLxNrYd8aw61iFxY-Xt+fqPkw@mail.gmail.com> <CAHOFxGqa9gEH5rsmMc=0=jzQn_nLuWTNkdRLnkF4Jj6zXqM7ig@mail.gmail.com> <CABZeWdwsaMvjU7ECLKpAr5WZVp+5LS7NAcqhzg1KHkFHQQr1xQ@mail.gmail.com> <14e326d2-7ee3-be5a-feb5-4e6c43425fb8@aklaver.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