pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: Magnus Hagander <magnus@hagander.net>
Cc: Vasu Madhineni <vasumdba1515@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: multiple tables got corrupted
Date: Thu, 24 Sep 2020 17:46:28 -0400
Message-ID: <20200924214628.GA22855@momjian.us> (raw)
In-Reply-To: <CABUevEz=ijXL=zjaOdDPoBd_Y3gEmO6Qgya876b-u-Jdrpb2ag@mail.gmail.com>
References: <CAFacQoEyobPXSfSf_vLMOnjDob2ROw7rpNSHmfTv0DE_MKtZzg@mail.gmail.com>
	<CABUevEya5XGeX0WRV+iEyXtDPhR1EzXwLS-RE6jdgV03Q42+YQ@mail.gmail.com>
	<CAFacQoFDNM1A67RUQv2WLj2224NC8rcL8rdcxoxHsahKeKdXMQ@mail.gmail.com>
	<CABUevEz=ijXL=zjaOdDPoBd_Y3gEmO6Qgya876b-u-Jdrpb2ag@mail.gmail.com>

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






view thread (9+ messages)

Message-ID: <20200924214628.GA22855@momjian.us>
Permalink:  ../20200924214628.GA22855@momjian.us/
Also on:    postgresql.org/message-id/20200924214628.GA22855@momjian.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: bruce@momjian.us, magnus@hagander.net, vasumdba1515@gmail.com
  Subject: Re: multiple tables got corrupted
  In-Reply-To: <20200924214628.GA22855@momjian.us>
  References: <CAFacQoEyobPXSfSf_vLMOnjDob2ROw7rpNSHmfTv0DE_MKtZzg@mail.gmail.com> <CABUevEya5XGeX0WRV+iEyXtDPhR1EzXwLS-RE6jdgV03Q42+YQ@mail.gmail.com> <CAFacQoFDNM1A67RUQv2WLj2224NC8rcL8rdcxoxHsahKeKdXMQ@mail.gmail.com> <CABUevEz=ijXL=zjaOdDPoBd_Y3gEmO6Qgya876b-u-Jdrpb2ag@mail.gmail.com> <20200924214628.GA22855@momjian.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox