Re: ADD COLUMN ts tsvector GENERATED too slow

From: Florents Tselai <florents(dot)tselai(at)gmail(dot)com>
To: Florents Tselai <florents(dot)tselai(at)gmail(dot)com>
Cc: 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 09:55:15
Message-ID: 9E6090C6-74EC-413F-9E3B-E6F2D59E772B@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Also, fwiw looking at top the CPU% and MEM% activity, looks like it does data crunching work.

> On 6 Jul 2022, at 12:48 PM, Florents Tselai <florents(dot)tselai(at)gmail(dot)com> wrote:
>
>
>
>> On 6 Jul 2022, at 12:38 PM, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com> wrote:
>>
>> On 06.07.22 10:42, Florents Tselai wrote:
>>> I have a beefy server (40+ worker processes , 40GB+ shared buffers) and a table holding (key text, text text,) of around 50M rows.
>>> These are text fields extracted from 4-5 page pdfs each.
>>> I’m adding the following generated col to keep up with tsvectors
>>> ALTER TABLE docs_text ADD COLUMN ts tsvector GENERATED ALWAYS AS (to_tsvector(’simple', left(text, 1048575))) STORED
>>> I expect this to be slow, but it’s been running for 18hrs already and I certainly hope I’ve done something wrong and there’s a smarter way.
>>
>> Maybe it's stuck on a lock? ALTER TABLE / ADD COLUMN requires an exclusive lock on the table.
>
> Looking at pg_locks and pg_stat_activity doesn’t seem like it’s stuck behind something like ACCESS SHARE or similar.
>
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavan Kumar S 2022-07-06 09:55:18 CPU is 100% azure rds postgreSQL-11
Previous Message Florents Tselai 2022-07-06 09:48:34 Re: ADD COLUMN ts tsvector GENERATED too slow