Discarding Data in a Dataset (CLI)

Use the following procedure to discard an entire archived dataset, or a portion of an archived dataset. Datasets are automatically pruned according to the existing retention policy, but they can also be pruned manually. This process might take several minutes to complete, depending on the size of the dataset and the amount of pruning required. Note that datasets can only be pruned when they are active.

  1. Go to analytics datasets.
  2. Enter show to view a list of active datasets.
    hostname:analytics datasets> show
    Datasets:
    
    DATASET     STATE    INCORE  ONDISK  NAME
    dataset-000 active    1.27M   15.5M  arc.accesses[hit/miss]
    dataset-001 active     517K   9.21M  arc.accesses[hit/miss=metadata hits][L2ARC eligibility]
    ...
    dataset-005 active     290K   7.80M  cpu.utilization
  3. Select one of the following options:
    1. To discard an entire archived dataset, enter destroy and the dataset. Then enter Y to confirm your action.
      hostname:analytics datasets> destroy dataset-005
      This will destroy "dataset-005". Are you sure? (Y/N) Y
    2. To discard only a portion of an archived dataset, enter select and the name of the archived dataset that you want to prune. Then enter prune, with any of these options: date, time, or granularity.
      • date - A date before which all data is removed. If a date is not specified, then the default is the present date and time. Enter the date using this format: year-month-date.
      • time - The time before which all data is removed. If a time is not specified, then the default is 12:00 AM, or 00:00 in 24-hour notation. Enter the time in 24-hour notation, using this format: hour:minute:second.
      • granularity - The level of data that is removed. The granularity can be presented as one of the following: second, minute, or hour.

        If minute or hour is specified, the lower level of data granularity is also deleted. For example, using the prune hour command also deletes the per-second and per-minute data.

      Detailed datasets can be pruned on several levels to reduce the quantity of saved data, which allows you to archive only a portion of the dataset. For example, use a series of prune commands to keep a day's worth of per-second data, a couple weeks of per-minute data, and six months of per-hour data. See Example 1-4.

Example 1-1 Pruning by Granularity

In the following example, only the granularity is specified. This example discards all per-second and per-minute data collected before 4:56 PM on April 2, 2020.

hostname:analytics datasets> select dataset-001
hostname:analytics dataset-001> prune minute
This will remove per-second and minute data collected prior to 2020-4-02
16:56:52.

Are you sure? (Y/N) Y

Example 1-2 Pruning by Date

In the following example, only a date is specified. This example discards all per-second data collected before midnight on December 1, 2020.

hostname:analytics dataset-001> prune 2020-12-01 second
This will remove per-second data collected prior to 2020-12-1 00:00.

Are you sure? (Y/N) Y

Example 1-3 Pruning by Date and Time

In the following example, both a date and time are specified. This example discards per-second data collected at and before 12 PM on June 3, 2020.

hostname:analytics dataset-001> prune 2020-06-03 12:00:01 second
This will remove per-second data collected prior to 2020-6-3 12:00:01.

Are you sure? (Y/N) Y

Example 1-4 Pruning Detailed Datasets

The following prune commands keep a day's worth of per-second data, a couple weeks of per-minute data, and six months of per-hour data older than December 15, 2020.

hostname:analytics dataset-001> prune 2020-12-14 second
hostname:analytics dataset-001> prune 2020-12-01 minute
hostname:analytics dataset-001> prune 2020-6-01 hour