Best way for searching JIRA change history programmatically

Hi all,

I've to get data from issues transferred among projects during an interval of time.

What's the better method to do this in my Java plugin?

Keeping in mind performance, I think that executing SQL query directly is not a good idea (tables changegroup and changeitem).

This query returns exactly that I need.



SELECT project.pkey 
FROM changegroup 
	INNER JOIN changeitem 
		ON changeitem.groupid = changegroup.ID 
	INNER JOIN jiraissue 
		ON jiraissue.ID = changegroup.issueid 
	INNER JOIN project 
		ON project.ID = jiraissue.project 
	INNER JOIN cwd_user 
		ON cwd_user.user_name = changegroup.AUTHOR 
WHERE changeitem.FIELD = 'project' 
	AND changegroup.CREATED BETWEEN ' startDateTime ' AND ' finishDateTime ';


Somebody knows the correct way to do this?

Any sample piece of code will be appreciated.


Thanks in advance.

Mário dos Santos [TOTVS]

1 answer

0 vote

Try for each issue in the proejct. But you may in fact get faster results using the lower-level APIs to execute the SQL you showed

Thank you very much for your reply Matt.

I've looked that interface before, but I've discarded it because I'd have to load all projects or issues to memory and iterate over them.
At this moment, we've 286008 issues in the instance which made me give up these interactions.
And what about the 'lower-level APIs' that you've mencioned, would you have any model or a path to them?

Take a look at the implementation in 


The same method and the ofBizDelegator part. You could create an EntityCondition for the project constraint

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

118 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you