Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    Deleting old database records

    Scheduled Pinned Locked Moved Support
    cleanupdatabasesbuildmaster
    2 Posts 1 Posters 9 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ? This user is from outside of this forum
      Guest
      last edited by

      As a short term fix for the database size limitations in SQLExpress, we need to purge old records from the database.

      We have already purged the log records and BuildOutputs, BuildTestResults, EventOccurenceDetails and EventOccurences.

      However the BuildExecution_PlanActionVariableValues table is using approx 3.3GB of space and we do not need to keep this data for builds older than say 3 weeks.

      Can you please provide some SQL which will delete old records from this table and any other linked tables.

      Product: BuildMaster
      Version: 4.2.6

      1 Reply Last reply Reply Quote 0
      • ? This user is from outside of this forum
        Guest
        last edited by

        NOTE : BuildMaster has Retention Policies which are strongly recommended, rather than manually purging data

        That being said, you can use the same strategy to delete from that table that you used for log entries:

        BuildMaster 4.2 and earlier:

        SELECT TOP 100 * FROM BuildExecution_PlanActionVariableValues
        --DELETE BuildExecution_PlanActionVariableValues
        WHERE BuildExecution_PlanAction_Id IN
           (SELECT BuildExecution_PlanAction_Id 
              FROM BuildExecution_PlanActions BEPA
                      INNER JOIN BuildExecutions BE
                            ON BE.Execution_Id = BEPA.Execution_Id
                         INNER JOIN Builds B
                            ON BE.Application_Id = B.Application_Id
                             AND BE.Release_Number = B.Release_Number
                             AND BE.Build_Number = B.Build_Number
                         WHERE B.BuildStatus_Name = 'Rejected')
        

        BuildMaster 4.3 through 4.9:

        SELECT TOP 100 * FROM BuildExecution_ActionGroupActionVariableValues
        --DELETE BuildExecution_ActionGroupActionVariableValues
        WHERE BuildExecution_ActionGroupAction_Id IN
           (SELECT BuildExecution_ActionGroupAction_Id 
              FROM BuildExecution_ActionGroupActions BEAGA
                     INNER JOIN BuildExecution_DeploymentPlans BDP
                            ON BEAGA.BuildExecution_DeploymentPlan_Id = BDP.BuildExecution_DeploymentPlan_Id
                      INNER JOIN BuildExecutions BE
                            ON BE.Execution_Id = BDP.Execution_Id
                         INNER JOIN Builds B
                            ON BE.Application_Id = B.Application_Id
                             AND BE.Release_Number = B.Release_Number
                             AND BE.Build_Number = B.Build_Number
                         WHERE B.BuildStatus_Name = 'Rejected')
        
        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • 1 / 1
        • First post
          Last post
        Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation