Finding Unused Spaces or Pages
Sometimes, you want to know what is not being used. It's great to know what's getting most attention, but what about stagnant pages, or even entire spaces that are no longer active?
While viewing space activity can provide hints, it doesn't always provide enough detail. It is possible to find out this information directly from the database.
The following query identifies the last date on which content was modified in each space within a single Confluence instance:
SELECT spaces.spacename, MAX(content.lastmoddate)
FROM content, spaces
WHERE content.spaceid = spaces.spaceid
GROUP BY spaces.spacename;
It returns a list of space names, and the last date and time at which any content was added or changed.
Alternatively, this query identifies spaces where the content hasn't changed since a specified date:
SELECT spaces.spacename, spaces.spacekey
FROM content, spaces
WHERE content.spaceid = spaces.spaceid
GROUP BY spaces.spacename, spaces.spacekey
HAVING MAX(content.lastmoddate) < '2006-10-10';
The result is a simple list of space names and corresponding space keys.
Similarly, to identify pages where content hasn't changed since a specified date:
SELECT c.title,
c.creationdate,
c.lastmoddate
FROM content c
WHERE c.prevver IS NULL
AND c.contenttype = 'PAGE'
AND c.content_status = 'current'
GROUP BY c.title, c.creationdate, c.lastmoddate
HAVING MAX(c.lastmoddate) < '2006-10-10';
The result will provide a list of page titles, created date, and last modified date. Change the lastmoddate
value as per your needs.