Re: "not related" code blocks for removal of dead rows when using vacuum and this kills the performance - Mailing list pgsql-performance

From Laurenz Albe
Subject Re: "not related" code blocks for removal of dead rows when using vacuum and this kills the performance
Date
Msg-id 6ba1f723a0b6af4a1deedbe543c70ba2630b4e09.camel@cybertec.at
Whole thread Raw
In response to "not related" code blocks for removal of dead rows when using vacuum and this kills the performance  (Lars Aksel Opsahl <Lars.Opsahl@nibio.no>)
Responses Re: "not related" code blocks for removal of dead rows when using vacuum and this kills the performance  (Lars Aksel Opsahl <Lars.Opsahl@nibio.no>)
List pgsql-performance
On Mon, 2024-02-19 at 16:14 +0000, Lars Aksel Opsahl wrote:
> Then we start testing VACUUM and very simple SQL testing in another window.
>
> We can now show we have performance of "3343.794 ms" and not "0.123 ms", which
> is what we get when we are able to remove dead rows and run a new analyze.
>
> The problem is that as long as the master code is active, we cannot remove
> alle dead rows and that what seems to be killing the performance.
>
> With active I mean in hanging on pg_sleep and remember that this master has
> not created the test table or inserted any data in this test table it self.
>
> Is the expected behavior ?

It is not entirely clear what you are doing, but it seems like you are holding
a database transaction open, and yes, then it is expected behavior that
VACUUM cannot clean up dead rows in the table.

Make sure that your database transactions are short.
Don't use table or row locks to synchronize application threads.
What you could use to synchronize your application threads are advisory locks,
they are not tied to a database transaction.

Yours,
Laurenz Albe



pgsql-performance by date:

Previous
From: Lars Aksel Opsahl
Date:
Subject: "not related" code blocks for removal of dead rows when using vacuum and this kills the performance
Next
From: Lars Aksel Opsahl
Date:
Subject: Re: "not related" code blocks for removal of dead rows when using vacuum and this kills the performance