title: Alfresco db content size and contentstore size: How to match?
body: <p>I have an SQL query to get the content size from a content URL, but when I execute the SQL and compare the result to the directory size of contentstore it doesn't match. For example first I get the content size from database (PostgreSQL):</p>
  
  <pre><code>SELECT count(*),
         SUM(round(u.content_size/1024/1024,2)) AS "Size (MB)",
         to_char(n.audit_created:: date,'yyyy') AS yyyy_
    FROM alf_node            AS n,
         alf_node_properties AS p,
         alf_node_properties AS p1,
         alf_namespace       AS ns,
         alf_qname           AS q,
         alf_content_data    AS d,
         alf_content_url     AS u
  WHERE n.id=p.node_id
    AND ns.id=q.ns_id
    AND p.qname_id=q.id
    AND p.long_value=d.id
    AND d.content_url_id=u.id
    AND p1.node_id=n.id
    AND p1.qname_id IN (SELECT id FROM alf_qname WHERE local_name='name')
  GROUP BY yyyy_
  ORDER BY yyyy_ DESC;
  </code></pre>
  
  <p>It gives me a total size of 600 GB. But when I see the size property for folder content store in <code>alf_data</code> it shows 2.4 TB. How is that possible?</p>