Re: ADD COLUMN ts tsvector GENERATED too slow

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Florents Tselai <florents(dot)tselai(at)gmail(dot)com>
Cc: Francisco Olarte <folarte(at)peoplecall(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: ADD COLUMN ts tsvector GENERATED too slow
Date: 2022-07-06 11:33:33
Message-ID: 20220706113333.leh3lnzkvzn2dgbo@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2022-Jul-06, Florents Tselai wrote:

> Actually, I monitored my disk usage and it was **definitely** working as
> It had already eaten up an additional 30% of my disk capacity.

Adding a column like this requires creating a second copy of the table,
copying all the contents from the old table (plus the new column) into
the new one, then recreating all indexes from scratch on the new copy of
the table. If you have a lot of indexes, this can be significant.
Also, AFAIU all data has to be uncompressed on read, then compressed
back on write.

Note: the 80 GB from pg_relation_size() does *not* include the size of
TOAST data. You're copying a lot of additional data. See
pg_table_size().

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"Hay quien adquiere la mala costumbre de ser infeliz" (M. A. Evans)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ludwig Isaac Lim 2022-07-06 12:24:00 Error when pasting function blocks into psql
Previous Message Florents Tselai 2022-07-06 10:43:47 Re: ADD COLUMN ts tsvector GENERATED too slow