Re: ERROR: unexpected chunk number 0 (expected 1) for toast value 76753264 in pg_toast_10920100

From: adsj(at)novozymes(dot)com (Adam =?utf-8?Q?Sj=C3=B8gren?=)
To: pgsql-general(at)postgresql(dot)org
Subject: Re: ERROR: unexpected chunk number 0 (expected 1) for toast value 76753264 in pg_toast_10920100
Date: 2018-04-05 15:19:58
Message-ID: 87k1tlel41.fsf@tullinup.koldfront.dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom writes:

> adsj(at)novozymes(dot)com (Adam =?utf-8?Q?Sj=C3=B8gren?=) writes:
>> Also, the error we are getting is now: "unexpected chunk number 2
>> (expected 3) for toast value 1498303849 in pg_toast_10919630", where
>> previously we've only seen "unexpected chunk number 0 (expected 1)".
>
>> We are kind of at a loss, so any suggestions on what we could try are
>> welcome.
>
> The basic thrust of these messages is "I'm reading what should be
> sequentially numbered data chunks for this toast OID, and the sequence
> numbers are wrong". Both of these instances could be explained by
> duplicate toast rows (or duplicate index entries pointing at one row),
> though of course that would just move to the next question of how it
> got that way. Anyway, you could move the investigation along with
> some manual checking into what's in that toast table. For instance
>
> select chunk_id, chunk_seq, ctid, xmin, xmax, length(chunk_data)
> from pg_toast.pg_toast_10919630
> where chunk_id = 1498303849
> order by 1,2;
>
> might be informative. If you do see what seem to be duplicate
> chunk_seq values, checking whether they're still there in a
> seqscan would be good.

Here's a statement which currently gives an unexpected chunk error:

efamroot(at)kat efam=# SELECT * FROM efam.sendreference WHERE id = '189909908';
ERROR: unexpected chunk number 0 (expected 1) for toast value 1698936148 in pg_toast_10919630

And when I run the suggested query, I get:

efamroot(at)kat efam=# select chunk_id, chunk_seq, ctid, xmin, xmax, length(chunk_data) from pg_toast.pg_toast_10919630 where chunk_id = 1698936148 order by 1,2;
chunk_id | chunk_seq | ctid | xmin | xmax | length
------------+-----------+--------------+------------+------+--------
1698936148 | 0 | (52888694,2) | 1511390221 | 0 | 1996
1698936148 | 1 | (52888694,4) | 1511390221 | 0 | 1148
(2 rows)

How would I go about checking if they are still in a seqscan?

(Note: this is on PostgreSQL 9.3.22.)

Best regards,

Adam

--
"No more than that, but very powerful all the Adam Sjøgren
same; simple things are good." adsj(at)novozymes(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adam =?utf-8?Q?Sj=C3=B8gren?= 2018-04-05 15:32:27 Re: ERROR: unexpected chunk number 0 (expected 1) for toast value 76753264 in pg_toast_10920100
Previous Message Dorian Hoxha 2018-04-05 14:52:16 Re: Concurrent CTE