Re: multiple tables got corrupted - Mailing list pgsql-general

From Bruce Momjian
Subject Re: multiple tables got corrupted
Date
Msg-id 20200924214628.GA22855@momjian.us
Whole thread Raw
In response to Re: multiple tables got corrupted  (Magnus Hagander <magnus@hagander.net>)
List 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@momjian.us>        https://momjian.us
  EnterpriseDB                             https://enterprisedb.com

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




pgsql-general by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Need explanation on index size
Next
From: Bruce Momjian
Date:
Subject: Re: Can I get some PostgreSQL developer feedback on these five general issues I have with PostgreSQL and its ecosystem?