""" smc=# select count(*) from blobs; count --------- 6482291 (1 row) root@db-standby-3390789616-7nvcj:/# pg_dump -t blobs > /dev/null pg_dump: Dumping the contents of table "blobs" failed: PQgetResult() failed. pg_dump: Error message from server: ERROR: missing chunk number 0 for toast value 19731789 in pg_toast_7830229 pg_dump: The command was: COPY public.blobs (id, blob, expire, created, project_id, last_active, count, size, gcloud, backup, compress) TO stdout; echo "select * from blobs limit 10000 offset 0" | psql -o /dev/null 2>&1 | wc -l """ import os, time n = 6482291//10000 + 2 t = time.time() start = 340 for i in range(start, n): s = 'echo "select * from blobs limit 10000 offset %s" | psql -o /dev/null 2>&1 | wc -l'%(i*10000) print("%s/%s"%(i,n), time.time() - t, s) c = int(os.popen(s).read()) if c > 0: print("FOUND IT: ", c) break