CoCalc Shared Fileskucalc / one-off / blobs / blobs.pyOpen in CoCalc with one click!
Authors: Harald Schilly, William A. Stein
Views : 15
1
"""
2
3
smc=# select count(*) from blobs;
4
count
5
---------
6
6482291
7
(1 row)
8
9
[email protected]:/# pg_dump -t blobs > /dev/null
10
pg_dump: Dumping the contents of table "blobs" failed: PQgetResult() failed.
11
pg_dump: Error message from server: ERROR: missing chunk number 0 for toast value 19731789 in pg_toast_7830229
12
pg_dump: The command was: COPY public.blobs (id, blob, expire, created, project_id, last_active, count, size, gcloud, backup, compress) TO stdout;
13
14
15
echo "select * from blobs limit 10000 offset 0" | psql -o /dev/null 2>&1 | wc -l
16
17
"""
18
19
import os, time
20
21
n = 6482291//10000 + 2
22
t = time.time()
23
start = 340
24
for i in range(start, n):
25
s = 'echo "select * from blobs limit 10000 offset %s" | psql -o /dev/null 2>&1 | wc -l'%(i*10000)
26
print("%s/%s"%(i,n), time.time() - t, s)
27
c = int(os.popen(s).read())
28
if c > 0:
29
print("FOUND IT: ", c)
30
break