From c9b6b9a5ca082fe7c1b6f58d7713f785a9eb6a5c Mon Sep 17 00:00:00 2001
From: Martial Simon <msimon_fr@hotmail.com>
Date: Mon, 15 Sep 2025 01:08:27 +0200
Subject: add: graphs et rushs

---
 graphs/sql/vault_cataloging/req02.sql | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 graphs/sql/vault_cataloging/req02.sql

(limited to 'graphs/sql/vault_cataloging/req02.sql')

diff --git a/graphs/sql/vault_cataloging/req02.sql b/graphs/sql/vault_cataloging/req02.sql
new file mode 100644
index 0000000..bdfecaa
--- /dev/null
+++ b/graphs/sql/vault_cataloging/req02.sql
@@ -0,0 +1,14 @@
+SELECT
+    id,
+    madelines_files_results.size AS stored_size,
+    d.decrypted,
+    COALESCE(madelines_files_results.size, d.size) AS calculated_size
+FROM dtf.madelines_files_results
+LEFT JOIN
+(
+    SELECT decrypted,AVG(size)::bigint AS size FROM dtf.madelines_files_results
+    WHERE parent_id IS NOT NULL
+    GROUP BY decrypted
+) AS d ON madelines_files_results.decrypted = d.decrypted
+WHERE parent_id IS NOT NULL
+ORDER BY madelines_files_results.id
-- 
cgit v1.2.3

