Easy way to know the original table row/column given a pg_toast.pg_toast_XXXX chunk_id ?

From: Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Easy way to know the original table row/column given a pg_toast.pg_toast_XXXX chunk_id ?
Date: 2014-01-24 15:03:01
Message-ID: 52E280A5.9000007@matrix.gatewaynet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hello,
just a general question regarding toast, we have run across various instances of problems
having to do with corrupted toast data as a consequence of hardware failures.
The ERRORs were of the type : "missing chunk number %d for toast value %u in %s"
The usual way people try to find the row in the original table is to try a (potentially large)
number of queries in a effort to narrow down the problem, and finally find the row
with the corrupted TOAST.
(yes i know writing a program to do it would be handy, unfortunately the said server of ours
lies somewhere in some ocean with limited ISDN connectivity, so in general deployments are a big PITA)

I understand the chunk_id is the "oid" of the "value" to be toasted, is there any way to get to the row/column
of the toasted table, faster than the aforementioned exhaustive search?

What i did in order to research this (not in a context of a specific problem)
was in my test server, to create a new row in some toasted table, and then find the newest additions (chunk_id) to the
corresponding toast table. But i could not find a way (via pg_* relations) to somehow link the new row of the original table
to the set of new rows (chunk_id, chunk_seq) in the toast table.

--
Achilleas Mantzios
Head of IT DEV
IT DEPT
Dynacom Tankers Mgmt

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Sergey Konoplev 2014-01-24 23:01:41 Re: Easy way to know the original table row/column given a pg_toast.pg_toast_XXXX chunk_id ?
Previous Message Bruce Momjian 2014-01-22 02:05:39 Re: Upgrading cluster with thousands of DBs