Re: PostgreSQL and a Catch-22 Issue related to dead rows

From: Christophe Pettus <xof(at)thebuild(dot)com>
To: Lars Aksel Opsahl <Lars(dot)Opsahl(at)nibio(dot)no>
Cc: "pgsql-performance(at)lists(dot)postgresql(dot)org" <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: PostgreSQL and a Catch-22 Issue related to dead rows
Date: 2024-12-09 14:32:59
Message-ID: 5EE4CC0C-E624-4E82-A2E8-B2EBA44D3521@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

> On Dec 9, 2024, at 03:02, Lars Aksel Opsahl <Lars(dot)Opsahl(at)nibio(dot)no> wrote:
> If there were a way to remove dead rows without requiring a commit from totally unrelated jobs, it would be much easier.

Without seeing into the future, PostgreSQL doesn't know if a particular open transaction is "totally unrelated" to any other open transaction. Any open transaction can potentially see rows that have been deleted or updated since it began, and without knowing what operations are coming, it doesn't know if it is safe to remove them.

(Strictly speaking, the rows you are describing are not "dead," in that they are still visible to some transaction.)

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2024-12-09 16:07:35 Re: PostgreSQL and a Catch-22 Issue related to dead rows
Previous Message Rick Otten 2024-12-09 14:25:45 Re: PostgreSQL and a Catch-22 Issue related to dead rows