Edit

Share via


Clean up records from System Job (AsyncOperationBase) and Process Log (WorkflowLogBase) tables

Note

The new and improved Power Platform admin center is now generally available. We're currently updating the documentation to reflect these changes, so check back to ensure that you're getting the latest updates.

The System Job (AsyncOperation) table stores system jobs. The name of the actual database table is AsyncOperationBase. System jobs represent asynchronous operations, including registered workflows, plug-ins, and background operations such as bulk deletion, bulk import, and rollup operations. After the system triggers an event, it executes all synchronous extensions. Then, it serializes the context for any asynchronous extensions and stores it in the database as an AsyncOperation record.

When an asynchronous workflow is triggered in your Dataverse organization, a record is created in the AsyncOperation table to track the processing of the async job. More records also are created in the Process Log (WorkflowLog) table to maintain logs for the workflow execution. The name of the actual database table is WorkflowLogBase. Business process flows (BPF) also store BPF stage transition and action logs for the BPF in the WorkflowLog table.

If your organization relies heavily on workflows or business process flows, the associated tables can grow significantly over time, potentially leading to performance degradation and excessive database storage consumption.

Bulk deletion jobs

All environments are configured with an out-of-the-box bulk deletion job to delete successfully completed workflow system jobs older than 30 days. Customers can configure other bulk deletion jobs to delete AsyncOperation records. We recommend setting up a job to delete completed system jobs—regardless of type or outcome—that are older than 30 days. This job helps prevent the AsyncOperation table from accumulating excess records.

All environments include a built-in bulk deletion job that removes successfully completed workflow system jobs older than 30 days. Customers can create more bulk deletion jobs to delete AsyncOperation records. We recommend configuring a job that deletes any completed system job—regardless of type or result—older than 30 days to prevent unnecessary buildup in the AsyncOperation table.

You can use the bulk deletion system jobs to delete unneeded records from both AsyncOperation and WorkflowLog tables. To view the bulk deletion system jobs:

  1. Sign in to the Power Platform admin center.
  2. In the navigation pane, select Manage, then in the Manage pane, select Environments.
  3. On the Environments page, select an environment.
  4. In the command bar, select Settings.
  5. Expand Data management, then select Bulk deletion.

From the Bulk Deletion grid, use the view selector to show the completed, in-progress, pending, and recurring bulk deletion system jobs.

The Recurring Bulk Deletion System Jobs view shows the out-of-the-box job definitions for the recurring bulk deletion system jobs.

When you open one of these system job records, you can see the query uses to identify which records to delete and the schedule the job runs on. For these out-of-the-box system jobs, you can't modify the query used by the system job, but you can modify the schedule the job runs on.

If you switch the view to display jobs that are scheduled, in progress, or completed, you can cancel, resume, or postpone the job using the options available in the Actions menu when viewing the record.

Create your own bulk deletion jobs

If the out-of-the-box system bulk deletion jobs don't meet your organization's needs, you can create your own bulk deletion job.

From the Bulk Deletion grid, select New on the command bar to define a query for the records you want to delete. Use the preview feature to review the records the query returns and verify that it captures the intended data set.

To clean up workflow records from the AsyncOperation table, in the Look for entity dropdown, select the System Jobs table; in the Use saved view dropdown, select [new] to create your own query. You can only delete completed workflows. Workflows waiting to run or currently in progress can't (and shouldn't be) deleted by your system job.

Add the following conditions to your query:

  • System Job Type Equals Workflow - target workflow records.
  • Status Equals Completed - only completed workflows are valid to complete.
  • [Optional] Filter on the Status Reason Equals Succeeded/Failed/Canceled - valid for completed status.
  • [Optional] Filter on Completed On field to only delete older workflows.
  • [Optional] Any more filters you want to apply.

Next you set the frequency of the bulk deletion job to run at. You can create a one-time bulk deletion job or define a schedule to allow your job to run at set intervals.

Priority-based, bulk delete jobs for asyncoperation

To unblock customers that have significant asyncoperation size, we introduced a priority-based bulk delete feature for asyncoperation cleanup. This feature is available by default for all organizations. Here are some key points to note:

  • Bulk delete priority applies only to newly created, nonrecurring bulk delete jobs for the AsyncOperation entity.
  • To maximize this feature's effectiveness and optimize job performance, create jobs with varying filter conditions—such as different date ranges, system job types, status codes, or other criteria.
  • Organizations can define up to five priority jobs. Any more jobs are created with default priority.
  • Regardless of the number of jobs for other entities in the queue, one AsyncOperation job can always be created with priority.
  • There's no change with respect to creation steps for bulk, delete jobs.

Best practices for designing workflows

After removing unnecessary records from your workflow tables, consider refining your workflow design to help slow future table growth

For asynchronous workflows, we recommend enabling Automatically delete completed workflow jobs (to save disk space) in the workflow editor. This setting allows the system to automatically delete logs for successful completed jobs, conserving storage space. Logs from failed workflow executions are always retained for troubleshooting purpose.

Set Workflow Job Retention to automatically delete completed workflow jobs.

For synchronous workflows, we recommend enabling Keep logs for workflow jobs that encountered errors in the workflow editor. This setting ensures that logs from failed executions are retained for troubleshooting, while logs from successful run are automatically deleted to save space.

Set Workflow Log Retention to keep logs for workflow jobs that encountered errors.

AsyncOperation file capacity usage

Historically, the entire async operation context used to be serialized directly in the AsyncOperation table Data property, leading to quick growth in size if there are asynchronous plug-in registrations on large records (such as attachment). Since early 2021, the data portion of async operations is moved to file store. As a result, async operation data size is partially counted in database capacity and partially in file capacity. This shift helps reduce the costs—since file capacity is charged at a lower rate than database capacity—and improves overall performance by enabling more efficient queries against the AsyncOperation table.

Note

Files related to AsyncOperation records can't be deleted directly. To reclaim file capacity, review the retention and cleanup policies for AsyncOperation records described in this article. When AsyncOperation records are deleted, their corresponding files get deleted as well.

For more information on Dataverse storage model and reporting, see New Microsoft Dataverse storage capacity.

See also

Reduce database storage
Remove a large amount of specific, targeted data with bulk deletion
Microsoft Dataverse real-time workflows
Classic Dataverse background workflows
Automatically delete completed background workflow jobs
Asynchronous service