Π£ Π²Π°Ρ Π±ΡΠ²Π°Π»ΠΎ ΡΠ°ΠΊΠΎΠ΅ Π½Π° ΡΠ΅ΡΠ²Π΅ΡΠ΅ Confluence Π·Π°ΠΊΠΎΠ½ΡΠΈΠ»ΠΎΡΡ ΠΌΠ΅ΡΡΠΎ, Π° Π²Ρ Π½Π΅ Π·Π½Π°Π΅ΡΠ΅ ΠΊΡΠΎ Π±ΠΎΠ»ΡΡΠ΅ Π²ΡΠ΅Π³ΠΎ Π·Π°Π³ΡΡΠΆΠ°Π΅Ρ Π²Π»ΠΎΠΆΠ΅Π½ΠΈΠΉ?
Π§ΡΠΎΠ±Ρ ΡΠ·Π½Π°ΡΡ ΡΡΠΎ Π½Π΅ΠΎΠ±Ρ ΠΎΠ΄ΠΈΠΌ Π΄ΠΎΡΡΡΠΏ ΠΊ Π² ΠΠ PostgreSQL confluence.
Π‘ ΠΏΠΎΠΌΠΎΡΡΡ SQL Π·Π°ΠΏΡΠΎΡΠΎΠΌ ΠΊ ΠΠ PostgreSQL ΠΌΠΎΠΆΠ½ΠΎ ΡΠ·Π½Π°ΡΡ ΠΏΠΎΠ»Π΅Π·Π½ΡΡ ΡΡΠ°ΡΠΈΡΡΠΈΠΊΡ ΠΏΠΎ Confluence.
ΠΠ±ΡΠΈΠΉ ΡΠ°Π·ΠΌΠ΅Ρ Π²ΡΠ΅Ρ Π²Π»ΠΎΠΆΠ΅Π½ΠΈΠΉ Π² Confluence:
SELECT s.spaceid,
s.spacename,
sum(LONGVAL)
FROM contentproperties c
JOIN content co ON c.contentid = co.contentid
JOIN spaces s ON co.spaceid = s.spaceid
WHERE c.contentid IN
(SELECT contentid
FROM content
WHERE contenttype = 'ATTACHMENT')
AND c.propertyname = 'FILESIZE'
GROUP BY s.spaceid
ORDER BY SUM DESC
LIMIT 5;
ΠΡΠ²ΠΎΠ΄ (spacename Π·Π°ΠΌΠ΅Π½ΠΈΠ»):
CΡΡΠ°Π½ΠΈΡΡ Ρ Π±ΠΎΠ»ΡΡΠΈΠ½ΡΡΠ²ΠΎΠΌ ΠΈΡΡΠΎΡΠΈΡΠ΅ΡΠΊΠΈΡ Π²Π΅ΡΡΠΈΠΉ Π² ΡΡΠ΅ΡΠ΅Π½ΠΈΠΈ:
SELECT title,
MAX(VERSION)
FROM content
WHERE contenttype = 'PAGE'
GROUP BY title
ORDER BY 2 DESC
LIMIT 5;
ΠΡΠ²ΠΎΠ΄:
CΠ°ΠΌΡΠ΅ Π±ΠΎΠ»ΡΡΠΈΠ΅ ΡΠ°ΠΉΠ»Ρ Π²Π»ΠΎΠΆΠ΅Π½ΠΈΠΉ Π² Π²Π°ΡΠ΅ΠΌ ΡΠΊΠ·Π΅ΠΌΠΏΠ»ΡΡΠ΅ Confluence
SELECT DISTINCT c.contentid,
c.title AS attachmentTitle,
u.username AS uploadedBy,
co.title AS pageTitle,
cn.longval AS bytes
FROM CONTENT AS c
JOIN USER_MAPPING AS u ON u.user_key = c.creator
JOIN CONTENT AS co ON c.pageid = co.contentid
JOIN CONTENTPROPERTIES AS cn ON cn.contentid = c.contentid
WHERE c.contenttype = 'ATTACHMENT'
AND cn.longval IS NOT NULL
ORDER BY cn.longval DESC
LIMIT 5;
ΠΡΠ²ΠΎΠ΄:
ΠΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΡΠ°Π½ΠΈΡ Π² ΠΊΠΎΡΠ·ΠΈΠ½Π΅ ΠΈ ΠΎΠ±ΡΠΈΠΉ ΡΠ°Π·ΠΌΠ΅Ρ ΡΡΡΠ°Π½ΠΈΡ Π² ΠΊΠΎΡΠ·ΠΈΠ½Π΅ Π½Π° ΠΏΡΠΎΡΡΡΠ°Π½ΡΡΠ²ΠΎ:
SELECT Count(content.contentid) AS number_of_trashed_pages,
Pg_size_pretty(SUM(Pg_column_size(bodycontent.BODY))) AS trash_total_size,
spaces.spacename AS space_name
FROM bodycontent
INNER JOIN content ON (content.contentid = bodycontent.contentid)
INNER JOIN spaces ON (content.spaceid = spaces.spaceid)
WHERE bodycontent.contentid IN
(SELECT contentid
FROM content
WHERE content_status = 'deleted'
AND contenttype = 'PAGE')
GROUP BY space_name
ORDER BY trash_total_size
LIMIT 5;
ΠΡΠ²ΠΎΠ΄:
ΠΠ±ΡΠΈΠΉ ΡΠ°Π·ΠΌΠ΅Ρ Π²Π»ΠΎΠΆΠ΅Π½ΠΈΠΉ, Π·Π°Π³ΡΡΠΆΠ΅Π½Π½ΡΡ ΠΊΠ°ΠΆΠ΄ΡΠΌ ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»Π΅ΠΌ Π½Π° Π²ΡΠ΅Ρ ΡΡΡΠ°Π½ΠΈΡΠ°Ρ
SELECT u.lower_username,
sum(cp.longval) AS "size"
FROM content c1
JOIN content c2 ON c1.contentid = c2.pageid
JOIN user_mapping u ON c1.creator=u.user_key
JOIN contentproperties cp ON c2.contentid = cp.contentid
WHERE c2.contenttype='ATTACHMENT'
GROUP BY u.lower_username
ORDER BY sum(cp.longval) DESC
LIMIT 5;
ΠΡΠ²ΠΎΠ΄:
P.S. ΠΠΎΠΏΠΎΠ»Π½ΡΠΉΡΠ΅ ΠΏΠΎΡΡ ΠΏΠΎΠ»Π΅Π·Π½ΡΠΌΠΈ SQL Π·Π°ΠΏΡΠΎΡΠ°ΠΌΠΈ Π΄Π»Ρ Confluence
ΠΡΡΠΎΡΠ½ΠΈΠΊ: habr.com