From 0701a210dba34fcaebd4633d3ee121cf38a73cbf Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Thu, 20 Mar 2014 22:28:15 -0700 Subject: [PATCH] Query to show files that have duplicate hashes. --- pq/dup.sql | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 pq/dup.sql diff --git a/pq/dup.sql b/pq/dup.sql new file mode 100644 index 0000000..e125e5f --- /dev/null +++ b/pq/dup.sql @@ -0,0 +1,17 @@ +SELECT + count(f.path) AS Cnt, + f.hash AS Hash, + array_agg(distinct i.path) Paths +FROM + files AS f +INNER JOIN + files i +ON + i.hash = f.hash +GROUP BY + f.hash +HAVING + count(f.path)>1 +ORDER BY + Cnt DESC +;