Error Reported During Table Query: "missing chunk number %d for toast value %u in pg_toast_XXXX"
Symptom
The error "missing chunk number %d for toast value %u in pg_toast_XXXX" is reported during table query.
Possible Causes
The data in the associated TOAST table is damaged.
TOAST is short for The OverSized Attribute Storage Technique. It is a technique for storing large column values in multiple physical rows in GaussDB(DWS). If a table contains large column values, it will have an associated TOAST table. If the OID of the table test is 2619, the name of the associated toast table will be pg_toast_2619.
Handling Procedure
- Query the damaged table based on the OID of the TOAST table (2619 in the example).
1 2 3 4 5
SELECT 2619::regclass; regclass -------------- pg_statistic (1 row)
- Perform REINDEX and VACUUM ANALYZE on the located damaged table. If REINDEX/VACUUM is displayed, the repair is complete. If an error is reported during the repair, go to Step 3.
1 2 3
REINDEX table pg_toast.pg_toast_2619; REINDEX table pg_statistic; VACUUM ANALYZE pg_statistic;
- Run the following command to locate the damaged data row in the table.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
DO $$ declare v_rec record; BEGIN for v_rec in SELECT * FROM pg_statistic loop raise notice 'Parameter is: %', v_rec.ctid; raise notice 'Parameter is: %', v_rec; end loop; END; $$ LANGUAGE plpgsql; NOTICE: 00000: Parameter is: (46,9) ERROR: XX000: missing chunk number 0 for toast value 30982 in pg_toast_2619 CONTEXT: PL/pgSQL function inline_code_block line 7 at RAISE
- Run the following command to delete the damaged data row located in the Step 3.
1
DELETE FROM pg_statistic WHERE ctid ='(46,9)';
- Repeat Step 3 and Step 4 until all incorrect data records are deleted.
- After all damaged data rows are deleted, run REINDEX and VACUUM ANALYZE, as described in Step 2, to repair the table again.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot