Skip to main content

Archive & Clean

NineData supports Archive & Clean functionality, allowing you to archive unused data to another database for backup purposes, freeing up storage space in the operational database and optimizing performance. This feature supports both one-time execution and periodic automatic execution.

Background Information

After running online data for a period of time, with a significant increase in data volume, the performance of writing, updating, and querying business data may be affected. At the same time, data from a certain period of time ago is often no longer frequently queried but still occupies storage space in the database. To meet the requirements of performance optimization and online storage space, we often need to manage Archive & Clean for data that meets certain conditions, and simultaneously clean up archived data.

NineData's Archive & Clean functionality supports one-time or periodic archiving and cleaning tasks, ensuring that your operational database maintains high performance and stable operation at all times.

Prerequisites

  • You have created or joined an organization, and this organization has subscribed to either or . Please ensure that your annual or monthly subscription is still active. For more information, please refer to Manage Organizations.
  • Your current account has switched to the target organization. For more information, please refer to Switching to an Organization.
  • The table to be archived must have a timestamp field.
  • The target database type is MySQL, PostgreSQL.

Submit Archive & Clean Task

  1. Log in to the NineData console.

  2. In the left navigation pane, click > .

  3. On the page, click .

  4. On the page, configure according to the table below.

    ParameterDescription
    Enter the name of the Archive & Clean task. For ease of later search and management, please use a meaningful name. Supports up to 64 characters.
    (Optional)Enter remarks, such as a description of the purpose of this Archive & Clean task.
    Select the policy of the Archive & Clean task. Choose or here. Supports the following three options:
    • : Archive the target data, copying the data that needs to be archived from the source database to the target database.
    • : Archive the target data first, then delete the archived data from the source database.
    • : This operation only deletes the target data and does not perform archiving.
    The data source and database (Schema) where the data to be archived is located.
    The data source and database (Schema) where the archived data will be stored. Not visible for .
    Select the execution frequency of the task.
    • : Execute only once.
    • : Create a periodic task that executes cyclically according to the selected period.
    Select the time zone of your target region.
    Select for periodic tasks, choose or to execute the task on the specified day of the week or month. Check to execute daily.
    For periodic tasks, select the time of day when the task will be executed during the selected period. Click Now to set the current time as the task execution time.
    Optional input for periodic tasks, limiting the duration of task execution, measured in hours. For example, you can schedule an archiving task to start at 0:00 during off-peak hours and set the execution duration to 6 hours. Therefore, even if the task hasn't completed by 6:00 in the morning, it will automatically stop to avoid disrupting business operations.
  5. Click to go to the page to configure the data to be archived.

    ParameterDescription
    Select the table where the archived data is located in the source table.
    Select the table where the archived data will be stored in the target table. The structure of this table needs to be consistent with the source table. If it is not consistent, you can manually map the table and column names by clicking on the right.
    Select a timestamp field as the basis for determining whether data needs to be archived. This field usually reflects the time when the data in the row was generated. For example, the order creation time field in your order table.
    Based on the selected earlier, select how many days of data to archive. Valid values are 1~3650 days. For example, if you need to archive or clean up data older than a year, enter 365 here.
    • : Manually map table and column names in the Archive & Clean scenario. For example, storing data from a certain column in the source table into a specified column in the target table.
    • : Delete the current record.
    Add a new record.
  6. Click . At the node, wait for the task status to change to , then click in the upper right corner of the page. In the pop-up window, select the workflow approvers, click , and enter the node. At the node, you can also perform the following operations:

    • Click the refresh icon in the upper right corner of the page to refresh the task status.
    • Click in the upper right corner of the page to directly withdraw the task or edit and resubmit it.
    • Click in the upper right corner of the page to copy a new task with the same configuration.
    tip
    • Depending on the configuration of the approval process, the number of approvers to be selected here may vary. Please select according to the actual situation.
    • If the feature is enabled in the current approval process, this section will display . You do not need to manually specify an approver; all personnel authorized to approve the current work order will receive approval notifications and be able to approve it.

    • If the data source is not configured with an approval process, the task will automatically skip the and nodes, proceed to the node, and change the task status to . You can then proceed directly to Step 8.
  7. When the task status changes to , you can perform the following operations before approval:

    • Click the refresh icon in the upper right corner of the page to refresh the task status.
    • Click in the upper right corner of the page to directly withdraw the task or edit and resubmit it.
    • Click to change the approver of the task.
    • Click in the page to view the execution objects of this task.
  8. When the task status changes to , click in the upper right corner of the page for the task's , choose , and click .

    • : Execute the task immediately.
    • (only for one-time tasks): Choose a time to execute the task.
  9. Wait for the task status to change to .

Submit Data Cleanup Task

  1. Log in to the NineData console.

  2. In the left navigation pane, click > .

  3. On the page, click .

  4. On the page, configure according to the table below.

    ParameterDescription
    Enter the name of the task. For ease of later search and management, please use a meaningful name. Supports up to 64 characters.
    (Optional)Enter remarks, such as a description of the purpose of this task.
    Select the policy of the Archive & Clean task. Choose here. Supports the following three options:
    • : Archive the target data, copying the data that needs to be archived from the source database to the target database.
    • : Archive the target data first, then delete the archived data from the source database.
    • : This operation only deletes the target data and does not perform archiving.
    The data source and database where the data to be cleaned up is located.
    Select the execution frequency of the task.
    • : Execute only once.
    • : Create a periodic task that executes cyclically according to the selected period.
    Select the time zone of your target region.
    Select for periodic tasks, choose or to execute the task on the specified day of the week or month. Check to execute daily.
    For periodic tasks, select the time of day when the task will be executed during the selected period. Click Now to set the current time as the task execution time.
  5. Click to go to the page to configure the data to be cleaned up.

    ParameterDescription
    Select the table where the data to be cleaned up is located in the source table.
    Select a timestamp field as the basis for determining whether data needs to be cleaned up. This field usually reflects the time when the data in the row was generated. For example, the order creation time field in your order table.
    Based on the selected earlier, select how many days of data to clean up. Valid values are 1~3650 days. For example, if you need to clean up data older than a year, enter 365 here.
    (Optional)Set filtering conditions. Only data that meets the filtering conditions will be cleaned up. If not set, all data that meets the conditions will be cleaned up by default. For example, using the MySQL official test data employees table, setting the filtering condition to emp_no>=10005 means that data with emp_no less than 10005 will not be cleaned up.
    : Delete the current record.
    Add a new record.
  6. Click . At the node, wait for the task status to change to , then click in the upper right corner of the page. In the pop-up window, select the approver(s), click , and enter the node. At the node, you can also:

    • Click the refresh icon in the upper right corner of the page to refresh the task status.
    • Click in the upper right corner of the page to directly withdraw the task or edit and resubmit it.
    • Click in the upper right corner of the page to copy a new task with the same configuration.
    tip
    • Depending on the configuration of the approval process, the number of approvers to be selected here may vary. Please select according to the actual situation.
    • If the feature is enabled in the current approval process, this section will display . You do not need to manually specify an approver; all personnel authorized to approve the current work order will receive approval notifications and be able to approve it.

    • If the data source is not configured with an approval process, the task will automatically skip the and nodes, proceed to the node, and change the task status to . You can then proceed directly to Step 8.
  7. When the task status changes to , you can perform the following operations before approval:

    • Click the refresh icon in the upper right corner of the page to refresh the task status.
    • Click in the upper right corner of the page to directly withdraw the task or edit and resubmit it.
    • Click to change the approver of the task.
    • Click in the page to view the execution objects of this task.
  8. When the task status changes to , click in the upper right corner of the page for the task's , choose , and click .

    • : Execute the task immediately.
    • (only for one-time tasks): Choose a time to execute the task.
  9. Wait for the task status to change to .

Approve Task

Prerequisites

  • The current task status is .
  • You are either or the for the current task.

Steps

  1. Log in to the NineData console.

  2. In the left navigation pane, click > .

  3. On the page, find the target task and click the task ID or in the column on the right side of the task.

    tip

    Alternatively, you can hover over the notification icon at the top of the page and click the target task on the tab.

  4. On the page, review the approval work order, and choose , , or based on the actual situation.

    OperationDescription
    Forward the task to another user for approval.
    Approve the application. After clicking , you can optionally enter as needed, and click .
    Reject the application. After clicking , you also need to enter , and click .