Issues with too many comments
This insight checks if any of your issues exceed the limit of comments.
Why is there a limit?
Jira Cloud limits the number of comments per issue, because adding unlimited entities often results in unusually large and complex data shapes, which in turn causes reliability and performance problems.
Migrations are exempt from this limit so they're not blocked. However, after migration, we'll automatically tidy up issues that exceed the limit in the following way:
- We’ll move comments above the limit into CSV files so they’re preserved outside the main comment stream.
- We’ll group these comments into separate CSV files based on permissions and authorship. For example, if the user Charlie made comments visible to everyone and others restricted to specific roles, we’ll create two files reflecting those visibility rules.
- We’ll attach each CSV file back onto the original issue, ensuring all historical comments remain accessible and associated with the same issue.
- Only comments beyond the limit will be transformed, with the oldest comments being transformed first.
- You won’t be able to add new comments once the limit is reached
No comments are deleted during this process — they're simply moved to attached CSV files so the issue remains readable and performant.
What’s the recommendation?
For active issues where you still add comments, you can use the ideas below to reduce their number. However, it might be easier to let us remove excess comments after you migrate and start fresh in new issues.
Delete extra comments RECOMMENDATION
Jira doesn’t have an easy way to delete comments in bulk. Below, we’ve added some ideas so you can check which one works for you.
Identify affected issues with SQL query
When viewing this recommendation from the dashboard, copy the provided SQL query and run it on your database.
The SQL query returns:
Issues with over 5,000 comments
Comment count for each issue
Delete extra comments with API
The following pages link to APIs used to delete issue comments.
Get a list of comment IDs under an issue: GET Get comments
Delete a comment based on its ID: DEL Delete comment
Below is an example of Python script that can be used to delete comments:
Remember to install jira and requests
from jira import JIRA
from datetime import datetime
import requests
from requests.auth import HTTPBasicAuth
def delete_old_comments(email, token, domain, issue_key, date_str):
# Connect to Jira
options = {'server': f'https://{domain}.atlassian.net'}
jira = JIRA(options, basic_auth=(email, token))
try:
# Parse the input date
cutoff_date = datetime.strptime(date_str, '%Y-%m-%d')
# Get the issue
issue = jira.issue(issue_key)
# Retrieve all comments
comments = jira.comments(issue)
# Iterate over comments and delete those older than the cutoff date
for comment in comments:
comment_created = datetime.strptime(comment.created.split('T')[0], '%Y-%m-%d')
if comment_created < cutoff_date:
# Delete the comment using REST API
comment_url = f"https://{domain}.atlassian.net/rest/api/3/issue/{issue_key}/comment/{comment.id}"
response = requests.delete(
comment_url,
auth=HTTPBasicAuth(email, token)
)
if response.status_code == 204:
print(f"Deleted comment {comment.id} created on {comment.created}: {comment.body[:50]}...")
else:
print(f"Failed to delete comment {comment.id}. Status code: {response.status_code}")
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == '__main__':
#Define your inputs here
email = '' #your email
api_token = '' #your token
domain = '' #your Jira domain, only the one before %.atlassian.net
issue_key = 'KEY-1234' #the issue key
date_str = '2025-01-09' #Format: YYYY-MM-DD
# Call the function with the specified inputs
delete_old_comments(email, api_token, domain, issue_key, date_str)