Jump to:

23368 Posts in 18143 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » Very large number of records in SiteTree_versions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1438 Views
  • andy_steel
    Avatar
    Community Member
    31 Posts

    Very large number of records in SiteTree_versions Link to this post

    Hi,

    I've noticed that one of our SS sites has 86,000 records in the SiteTree_versions table. There are only 166 pages in the SiteTree folder.

    This is causing problems when releasing new updates to the site. I added a new page type, so this changed the ENUM on the SiteTree_versions table, causing the query to run for 5 - 10 minutes.

    I would rather not remove all records from this table. Keeping the last revision or 2 would make sense. What is the best way to clear out the majority of these records?

    Thanks,
    Andy

  • rbquirke
    Avatar
    Community Member
    70 Posts

    Re: Very large number of records in SiteTree_versions Link to this post

    changing the table structure (which is what you are doing adding a new page type) is going to take a while to run, but this is only an issue when adding new code to the site. It should not affect day to day operations.

    If you do want to remove some of the rows from the Sitetree_versions table, you could run an sql command like:
    "DELETE FROM `SiteTree_versions` WHERE `Created` < '2009-03-01 00:00:00'"

    This would delete all rows created before March 1st. You could write something trickier to only leave the two most recent versions, but that would take a bit of effort....

    Deleting rows should not affect the revision function (other than removing old data).

  • andy_steel
    Avatar
    Community Member
    31 Posts

    Re: Very large number of records in SiteTree_versions Link to this post

    Thanks rbquirke.

    I think I'll remove the old revisions by date. The other method will take too long to implement.

    Having too many records in the versions table is quite dangerous since running /dev/build on a live server can kill the performance on a server.
    Perhaps it is worth adding a fix (or at least warning) to the /dev/build scripts to solve this issue?

    1438 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.