Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kLZ4U-0002Ba-2g for pgsql-general@arkaria.postgresql.org; Thu, 24 Sep 2020 21:46:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kLZ4T-00066k-2O for pgsql-general@arkaria.postgresql.org; Thu, 24 Sep 2020 21:46:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kLZ4S-00066d-Qc for pgsql-general@lists.postgresql.org; Thu, 24 Sep 2020 21:46:32 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kLZ4Q-0008LP-7X for pgsql-general@postgresql.org; Thu, 24 Sep 2020 21:46:32 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1kLZ4O-0001Gk-2P; Thu, 24 Sep 2020 17:46:28 -0400 Date: Thu, 24 Sep 2020 17:46:28 -0400 From: Bruce Momjian To: Magnus Hagander Cc: Vasu Madhineni , pgsql-general Subject: Re: multiple tables got corrupted Message-ID: <20200924214628.GA22855@momjian.us> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee