Created
October 10, 2017 16:16
-
-
Save sujaypillai/7b1c43fabc0c1486d1da573ecbb2b6f9 to your computer and use it in GitHub Desktop.
Find the database tables that are using the most space on disk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT relname AS "tablename", reltuples AS "rows", relpages * 8 / 1024 AS "MB" FROM pg_class | |
| WHERE relname like 'alf%' | |
| OR relname like 'act%' | |
| OR relname like 'avm%' | |
| OR relname like 'jbpm%' | |
| ORDER BY relpages DESC; |
Author
Author
-- Find the total space occupied by documents on disk
SELECT count(*),round(SUM(u.content_size)/1024/1024, 3) 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;
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
C:\Alfresco514\postgresql\bin>pg_resetxlog.exe C:\Alfresco514\alf_data\postgresql
Transaction log reset
select current_query from pg_stat_activity where
current_query <> '' and current_query not like
'%pg_stat_activty%';