Re: multiple tables got corrupted

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Vasu Madhineni <vasumdba1515(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: multiple tables got corrupted
Date: 2020-09-24 21:46:28
Message-ID: 20200924214628.GA22855@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Sep 15, 2020 at 07:58:39PM +0200, Magnus Hagander wrote:
> Try reading them "row by row" until it breaks. That is, SELECT * FROM ... LIMIT
> 1, then LIMIT 2 etc. For more efficiency use a binary search starting at what
> seems like a reasonable place looking at the size of the table vs the first
> failed block to make it faster, but the principle is the same. Once it fails,
> you've found a corrupt block...

You can also include the invisible 'ctid' column so you can see the
block number of each row, e.g.:

SELECT ctid, relname FROM pg_class LIMIT 2;
ctid | relname
--------+--------------
(0,46) | pg_statistic
(0,47) | pg_type

The format is page number, item number on page.

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EnterpriseDB https://enterprisedb.com

The usefulness of a cup is in its emptiness, Bruce Lee

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2020-09-24 21:52:46 Re: Can I get some PostgreSQL developer feedback on these five general issues I have with PostgreSQL and its ecosystem?
Previous Message Peter Geoghegan 2020-09-24 15:41:31 Re: Need explanation on index size