Re: Dropping column from big table

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: Dropping column from big table
Дата
Msg-id f70b1f5c575497a615c797588964d3c21823ef7e.camel@cybertec.at
обсуждение исходный текст
Ответ на Re: Dropping column from big table  ("Peter J. Holzer" <hjp-pgsql@hjp.at>)
Ответы Re: Dropping column from big table
Список pgsql-general
On Sun, 2024-07-14 at 00:05 +0200, Peter J. Holzer wrote:
> On 2024-07-11 10:06:47 +0200, Laurenz Albe wrote:
> > On Thu, 2024-07-11 at 13:10 +0530, sud wrote:
> > > Dropping will take it's own time for post vacuum however as you
> > > rightly said, it won't be blocking which should be fine. 
> >
> > I am not certain if you understood this correctly.
> >
> > Dropping a column is fast, but doesn't reclaim the space.
> > VACUUM won't block anything, but won't reclaim the space.
> > VACUUM (FULL) will block everything, but will also not reclaim the space.
> >
> > You'd need to use a form of ALTER TABLE that rewrites the table,
> > as indicated in the documentation.
>
> Unfortunately the documentation indicates very little. It mentions that
> the table will be rewritten with
>
> * SET ACCESS METHOD
> * a volatile DEFAULT
> * changing the type of an existing column (unless binary coercible)
>
> All three change something which you probably don't want to change.

Hm, true.

You can always do

  UPDATE tab SET id = id;

followed by

  VACUUM (FULL) tab;

Yours,
Laurenz Albe



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

Предыдущее
От: "Peter J. Holzer"
Дата:
Сообщение: Re: Dropping column from big table
Следующее
От: Ron Johnson
Дата:
Сообщение: How does this FK constraint error happen?