From e0ad2e3be5286b2703df8f0a98b450658e28d28b Mon Sep 17 00:00:00 2001
From: Bryan Newbold <bnewbold@archive.org>
Date: Tue, 12 Nov 2019 13:22:18 -0800
Subject: SQL stats and commands (mostly from sept 2019)

---
 sql/dump_ungrobid_pdf.sql | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 sql/dump_ungrobid_pdf.sql

(limited to 'sql/dump_ungrobid_pdf.sql')

diff --git a/sql/dump_ungrobid_pdf.sql b/sql/dump_ungrobid_pdf.sql
new file mode 100644
index 0000000..3e6d782
--- /dev/null
+++ b/sql/dump_ungrobid_pdf.sql
@@ -0,0 +1,15 @@
+
+-- Run like:
+--   psql sandcrawler < dump_ungrobid_pdf.sql | sort -S 4G | uniq -w 40 | cut -f2 > dump_ungrobid_pdf.2019-09-23.json
+
+BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE READ ONLY DEFERRABLE;
+
+COPY (
+    SELECT cdx.sha1hex, row_to_json(cdx) FROM cdx
+    WHERE cdx.mimetype = 'application/pdf'
+    AND NOT EXISTS (SELECT grobid.sha1hex FROM grobid WHERE cdx.sha1hex = grobid.sha1hex)
+)
+TO STDOUT
+WITH NULL '';
+
+ROLLBACK;
-- 
cgit v1.2.3

