pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Evan Bauer <evanbauer@mac.com>
To: Mariel Cherkassky <mariel.cherkassky@gmail.com>
Cc: pgsql-admin@lists.postgresql.org
Subject: Re: change bigint column to int
Date: Thu, 01 Nov 2018 07:54:50 -0400
Message-ID: <117C35AF-8395-4D7F-842B-A63B7141269B@mac.com> (raw)
In-Reply-To: <CA+t6e1nSubJm8pJ4WsKpR_HHiNsLPtCLLGDzMNQLcXwhYgijkA@mail.gmail.com>
References: <CA+t6e1nSubJm8pJ4WsKpR_HHiNsLPtCLLGDzMNQLcXwhYgijkA@mail.gmail.com>

Mariel,

Just run a query and make certain that all values currently stored in the column fit in 4 bytes (+/- 2,147,483,648) before doing the ALTER.

Cheers,

Evan

Sent from my iPhone

> On Nov 1, 2018, at 06:20, Mariel Cherkassky <mariel.cherkassky@gmail.com> wrote:
> 
> Hi,
> 
> I want to change the column type from bigint to int to save space. By doing so, does it include some risks ? As I see it, I should only run vacuum full afterwards if I want to return space to the os right ?
> 

view thread (7+ messages)  latest in thread

Message-ID: <117C35AF-8395-4D7F-842B-A63B7141269B@mac.com>
Permalink:  ../117C35AF-8395-4D7F-842B-A63B7141269B@mac.com/
Also on:    postgresql.org/message-id/117C35AF-8395-4D7F-842B-A63B7141269B@mac.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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: evanbauer@mac.com, mariel.cherkassky@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: change bigint column to int
  In-Reply-To: <117C35AF-8395-4D7F-842B-A63B7141269B@mac.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