|
|
|
@ -210,7 +210,8 @@ CREATE MATERIALIZED VIEW master_index_stats ( |
|
|
|
|
valid_groups, |
|
|
|
|
groups, |
|
|
|
|
valid_keys, |
|
|
|
|
keys |
|
|
|
|
keys, |
|
|
|
|
size |
|
|
|
|
) AS |
|
|
|
|
SELECT |
|
|
|
|
m.id, |
|
|
|
@ -219,13 +220,15 @@ SELECT |
|
|
|
|
COALESCE(g.valid_groups, 0), |
|
|
|
|
COALESCE(g.groups, 0), |
|
|
|
|
COALESCE(g.valid_keys, 0), |
|
|
|
|
COALESCE(g.keys, 0) |
|
|
|
|
COALESCE(g.keys, 0), |
|
|
|
|
COALESCE(a.size, 0) + COALESCE(g.size, 0) |
|
|
|
|
FROM master_indexes m |
|
|
|
|
LEFT JOIN ( |
|
|
|
|
SELECT |
|
|
|
|
a.master_index_id, |
|
|
|
|
COUNT(*) FILTER (WHERE c.id IS NOT NULL OR (a.version = 0 AND a.crc32 = 0)) AS valid_indexes, |
|
|
|
|
COUNT(*) AS indexes |
|
|
|
|
COUNT(*) AS indexes, |
|
|
|
|
SUM(length(c.data)) FILTER (WHERE c.id IS NOT NULL) AS size |
|
|
|
|
FROM master_index_archives a |
|
|
|
|
LEFT JOIN resolve_index(a.archive_id, a.crc32, a.version) c ON TRUE |
|
|
|
|
GROUP BY a.master_index_id |
|
|
|
@ -236,7 +239,8 @@ LEFT JOIN ( |
|
|
|
|
COUNT(*) FILTER (WHERE c.id IS NOT NULL) AS valid_groups, |
|
|
|
|
COUNT(*) AS groups, |
|
|
|
|
COUNT(*) FILTER (WHERE c.key_id IS NOT NULL) AS valid_keys, |
|
|
|
|
COUNT(*) FILTER (WHERE c.encrypted) AS keys |
|
|
|
|
COUNT(*) FILTER (WHERE c.encrypted) AS keys, |
|
|
|
|
SUM(length(c.data)) FILTER (WHERE c.id IS NOT NULL) AS size |
|
|
|
|
FROM resolved_indexes i |
|
|
|
|
JOIN index_groups ig ON ig.container_id = i.container_id |
|
|
|
|
LEFT JOIN resolve_group(i.archive_id, ig.group_id, ig.crc32, ig.version) c ON TRUE |
|
|
|
|