Re: Determine potential change in table size after a column dropped?

Поиск
Список
Период
Сортировка
От Wells Oliver
Тема Re: Determine potential change in table size after a column dropped?
Дата
Msg-id CAOC+FBVWoYZS9u1yvAXRa=3fH8gA1m99L+ujAgt4fLf_-kq4ag@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Determine potential change in table size after a column dropped?  (Ron <ronljohnsonjr@gmail.com>)
Ответы Re: Determine potential change in table size after a column dropped?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: Determine potential change in table size after a column dropped?  (Laurenz Albe <laurenz.albe@cybertec.at>)
Список pgsql-admin
I need only drop the column and VACUUM FULL the table, and not the entire DB, right?

On Sat, Jan 22, 2022 at 5:38 AM Ron <ronljohnsonjr@gmail.com> wrote:
On 1/22/22 1:43 AM, Vijaykumar Jain wrote:


On Sat, Jan 22, 2022, 12:47 PM Wells Oliver <wells.oliver@gmail.com> wrote:
I have a large large large table with many many many rows, and it's a certain size in pg_relation_size -- there's a timestamp with tz column on this table that's mostly kind of useless, and I want to figure out how much space it would free if we just dropped it. Can I easily do this?


The DROP COLUMN form does not physically remove the column, but simply makes it invisible to SQL operations. Subsequent insert and update operations in the table will store a null value for the column. Thus, dropping a column is quick but it will not immediately reduce the on-disk size of your table, as the space occupied by the dropped column is not reclaimed. The space will be reclaimed over time as existing rows are updated.

To force immediate reclamation of space occupied by a dropped column, you can execute one of the forms of ALTER TABLE that performs a rewrite of the whole table. This results in reconstructing each row with the dropped column replaced by a null value.

What about VACUUM FULL?

--
Angular momentum makes the world go 'round.


--

В списке pgsql-admin по дате отправления:

Предыдущее
От: Greg Spiegelberg
Дата:
Сообщение: Re: Gauging progress of COPY?
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Determine potential change in table size after a column dropped?