Re: ADD COLUMN ts tsvector GENERATED too slow - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: ADD COLUMN ts tsvector GENERATED too slow
Date
Msg-id 20220706113333.leh3lnzkvzn2dgbo@alvherre.pgsql
Whole thread Raw
In response to Re: ADD COLUMN ts tsvector GENERATED too slow  (Florents Tselai <florents.tselai@gmail.com>)
List 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)



pgsql-general by date:

Previous
From: Florents Tselai
Date:
Subject: Re: ADD COLUMN ts tsvector GENERATED too slow
Next
From: Ludwig Isaac Lim
Date:
Subject: Error when pasting function blocks into psql