How to Query the Database to Find a Page with a Specific Label

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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

Reason

To find all the pages created by a certain user and containing a specific label.

Solution

Procedure

Run the following query in the database:

1 2 3 4 SELECT * FROM CONTENT WHERE CONTENTID IN (SELECT CONTENTID FROM CONTENT_LABEL WHERE LABELID IN (SELECT LABELID FROM LABEL WHERE NAME='<label name>' AND OWNER IN (SELECT USER_KEY FROM USER_MAPPING WHERE LOWER_USERNAME = '<username>')));

Be sure to replace <label name> with the actual label name you're looking for, and <username> with the username you're looking for.

You may need to modify the query for your database.

Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.