SELECT ctid, chunk_id, chunk_seq, md5(chunk_data) FROM pg_toast.pg_toast_16103925 WHERE chunk_id = 64265646; ctid | chunk_id | chunk_seq | md5 ------+----------+-----------+----- (0 rows)
SELECT count(1) FROM pg_toast.pg_toast_16103925 WHERE chunk_id = 64265646; count ------- 2 (1 row) >From the aboving query,I think the problem is form the index. First query use the default toast index (chunk_id, chunk_seq) to search, it's found none. The second query use the seq scan and find two matched rows. So I think the index store value maybe not match the heap tuple. If have the corruption toast data, I think we can use the tool to see the index and heap tuple data. typedef struct IndexTupleData { ItemPointerData t_tid; /* reference TID to heap tuple */ /* --------------- * t_info is laid out in the following fashion: * * 15th (high) bit: has nulls * 14th bit: has var-width attributes * 13th bit: AM-defined meaning * 12-0 bit: size of tuple * --------------- */ unsigned short t_info; /* various info about tuple */ } IndexTupleData; /* MORE DATA FOLLOWS AT END OF STRUCT */ In my env, I encounter many cases like "missing chunk number 0 for toast value XXX in pg_toast_2619" after shutdown the service forcely without stopping the database. The 2619 is the pg_statistic which is update frequently. -- Sent from: https://www.postgresql-archive.org/PostgreSQL-hackers-f1928748.html