Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can i remove items from the changeitem table.

BroadcomS
Contributor
June 1, 2014

My changeitem table now consumes over 50 percent of my database and it is growing, currently it is 19g on a 30g database with 500 issues. Most of the entries are due builds and interaction with SCM systems. What can i do

1) remove items periodically from change table.

2) limit the number of changeitems kept per issue.

1 answer

1 accepted

1 vote
Answer accepted
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 1, 2014

Removing the data destroys the information about changes, so you need to think very carefully before you do this.

The only way to do it without coding is to use SQL directly to kill the lines you decide you don't want. As you specify builds and SCM interactions, I'd attack them first. Identify the patterns, work out a decent rule for them, and remove the lines in SQL. However, you will also need to remove lines from changeGROUP for consistency - removing any changegroup lines that no longer contain any changeitems.

When you run the SQL for the two tables, you absolutely MUST backup the database, have Jira offline, and reindex as soon as you restart Jira.

As for point 2 - you can't. There's no limitations in Jira, it just keeps tracking changes.

BroadcomS
Contributor
June 6, 2014

Thanks, you answered my question.

Serhii Riabovil September 21, 2017 edited

 

you will also need to remove lines from changeGROUP for consistency - removing any changegroup lines that no longer contain any changeitems

those who interested, PostgreSQL snippet to delete change groups that don't have change items

-- WARNING! DO NOT APPLY FOR PROD INSTANCE!

DELETE
FROM changegroup
WHERE ID = any (
  ARRAY(
    SELECT G.id
    FROM changegroup G
    LEFT JOIN changeitem I ON I.groupid = G.id
    WHERE I.groupid IS NULL
  )
);

 

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 21, 2017

DO NOT DO THAT.

There are items in changegroup that have no items for very good reasons.  You are damaging your data.

Please, restore your data from the backup you took before doing this and don't ever do it again.

Serhii Riabovil September 21, 2017 edited

There are items in changegroup that have no items for very good reasons. 

Nic Brough, any example of such entries? Checked on a large enough prod JIRA instance and didn't find any Change groups without Change items.

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 21, 2017

Yes.

Why are you removing them?

Serhii Riabovil September 21, 2017 edited

Why are you removing them?

In my case it was for partly anonymized staging (copy of prod) instance.

But generally I added the snippet for those who trying to do this:

you will also need to remove lines from changeGROUP for consistency - removing any changegroup lines that no longer contain any changeitems

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 21, 2017

Ok, you're going about "anonymising" it in a broken way.  You should never delete this stuff, just change it so it's not identifiable.

Please, step away from the database, you could be doing all sorts of damage by doing things you don't understand.

For anonymisation, do it the correct way - see https://confluence.atlassian.com/jira/anonymising-jira-data-139008.html

Like Phil Evans likes this

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Atlassian Community Events