How to retrieve the Comments in Pages and Blog posts via SQL

Platform Notice: Cloud and Data Center - This article applies equally to both cloud and data center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Confluence considers Comment on pages and blog posts as content and it holds the metadata of the comments in the CONTENT table and the data itself in the BODYCONTENT table.

Solution

If you want to retrieve all the comments in your Confluence instance, you can use the following SELECT statement:

1 2 3 4 5 6 SELECT * FROM BODYCONTENT WHERE CONTENTID IN ( SELECT CONTENTID FROM CONTENT WHERE CONTENTTYPE = 'COMMENT')

To fetch the comments of an individual page, you can use the following statement (replacing the <pageID> tags):

1 2 3 4 5 6 7 SELECT * FROM CONTENT C INNER JOIN BODYCONTENT B ON C.CONTENTID = B.CONTENTID WHERE C.CONTENTTYPE='COMMENT' AND PREVVER is null AND CONTENT_STATUS = 'current' and pageid=<pageID>

Related content:

Updated on March 24, 2025

Still need help?

The Atlassian Community is here for you.