pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Florents Tselai <florents.tselai@gmail.com>
Cc: Francisco Olarte <folarte@peoplecall.com>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: ADD COLUMN ts tsvector GENERATED too slow
Date: Wed, 6 Jul 2022 13:33:33 +0200
Message-ID: <20220706113333.leh3lnzkvzn2dgbo@alvherre.pgsql> (raw)
In-Reply-To: <D8E9BE00-14C4-4964-8DB5-D91A3FDA9456@gmail.com>

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)





view thread (9+ messages)  latest in thread

Message-ID: <20220706113333.leh3lnzkvzn2dgbo@alvherre.pgsql>
Permalink:  ../20220706113333.leh3lnzkvzn2dgbo@alvherre.pgsql/
Also on:    postgresql.org/message-id/20220706113333.leh3lnzkvzn2dgbo@alvherre.pgsql

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: alvherre@alvh.no-ip.org, florents.tselai@gmail.com, folarte@peoplecall.com, peter.eisentraut@enterprisedb.com
  Subject: Re: ADD COLUMN ts tsvector GENERATED too slow
  In-Reply-To: <20220706113333.leh3lnzkvzn2dgbo@alvherre.pgsql>
  References: <D8E9BE00-14C4-4964-8DB5-D91A3FDA9456@gmail.com> <20220706113333.leh3lnzkvzn2dgbo@alvherre.pgsql>

* 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