diff options
author | Helmut Grohne <helmut@subdivi.de> | 2013-03-10 07:38:22 +0100 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2013-03-10 07:38:22 +0100 |
commit | 4326c4766a6e1fb30bdb6999922ad0620543fff0 (patch) | |
tree | f85625d384082a6a7cd1728ee1fdd289808dd743 /README | |
parent | 5c0dcba3229b8c3e0faf42cf3e07cb82ee1369cd (diff) | |
download | debian-dedup-4326c4766a6e1fb30bdb6999922ad0620543fff0.tar.gz |
README: update queries to match content table split
Diffstat (limited to 'README')
-rw-r--r-- | README | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -30,17 +30,17 @@ SQL database by hand. Here are some example queries. Finding the 100 largest files shared with multiple packages. - SELECT a.package, a.filename, b.package, b.filename, a.size FROM content AS a JOIN content AS b ON a.hash = b.hash WHERE (a.package != b.package OR a.filename != b.filename) ORDER BY a.size DESC LIMIT 100; + SELECT a.package, a.filename, b.package, b.filename, a.size FROM content AS a JOIN hash AS ha ON a.id = ha.cid JOIN hash AS hb ON ha.hash = hb.hash JOIN content AS b ON b.id = hb.cid WHERE (a.package != b.package OR a.filename != b.filename) ORDER BY a.size DESC LIMIT 100; Finding those top 100 files that save most space when being reduced to only one copy in the archive. - SELECT hash, sum(size)-min(size), count(*), count(distinct package) FROM content GROUP BY hash ORDER BY sum(size)-min(size) DESC LIMIT 100; + SELECT hash, sum(size)-min(size), count(*), count(distinct package) FROM content JOIN hash ON content.id = hash.cid WHERE hash.function = "sha512" GROUP BY hash ORDER BY sum(size)-min(size) DESC LIMIT 100; Finding PNG images that do not carry a .png file extension. - SELECT package, filename, size FROM content WHERE function = "image_sha512" AND filename NOT LIKE "%.png"; + SELECT package, filename, size FROM content JOIN hash ON content.id = hash.cid WHERE function = "image_sha512" AND filename NOT LIKE "%.png"; Finding .gz files which either are not gziped or contain errors. - SELECT package, filename FROM content AS a WHERE function = "sha512" AND filename LIKE "%.gz" AND (SELECT count(*) FROM content AS b WHERE b.package = a.package AND b.filename = a.filename AND b.function = "gzip_sha512") = 0; + SELECT a.package, a.filename FROM content AS a JOIN hash AS ha ON a.id = ha.cid WHERE ha.function = "sha512" AND a.filename LIKE "%.gz" AND (SELECT count(*) FROM content AS b JOIN hash AS hb ON b.id = hb.cid WHERE b.package = a.package AND b.filename = a.filename AND hb.function = "gzip_sha512") = 0; |