> For the complete documentation index, see [llms.txt](https://doc.traceye.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.traceye.io/services/dedicated-indexing/graph-nodes/subgraph-manual/index-data-pruning.md).

# Index Data Pruning

Subgraphs, by default, store a full version history for entities, allowing consumers to query the subgraph as of any historical block. **Index Data Pruning** is an operation that deletes entity versions from a subgraph older than a certain block, so it is no longer possible to query the subgraph as of prior blocks. In GraphQL, those are only queries with a constraint `block { number: <n> } }` or a similar constraint by block hash where `n` is before the block to which the subgraph is pruned. Queries that are run at a block height greater than that are not affected by pruning, and there is no difference between running these queries against an unpruned and a pruned subgraph.

**History Blocks** setting which is used to periodically check whether the subgraph has accumulated more history than that. Whenever the subgraph does contain more history than that, the subgraph is automatically repruned. Repruning is performed whenever the subgraph has more than `History Blocks * 1.8` blocks of history.

## Manage Index Data Pruning On Subgraph

**Step 1:** Purchase **Index Data Pruning** addons by navigating to [Graph Nodes Purchase](https://app.traceye.io/subgraph/graph-node/purchase).

{% hint style="info" %}
Refer [Purchase Subscription](/services/dedicated-indexing/graph-nodes/quick-start-guide/purchase-subscription.md) page for more details.
{% endhint %}

**Step 2:** To enable the **Storage & Query Optimizer** addon service, navigate to the specific node where it needs to be enabled.

{% hint style="info" %}
Refer [Manage Addon Services](/services/dedicated-indexing/graph-nodes/graph-node-manual/manage-addon-services.md) page for more details.
{% endhint %}

**Step 3:** Select a subgraph to navigate to its details page, then click on the **Index Data Pruning** tab. This section display **Index Data Pruning** configuration for the respective subgraph.

<figure><img src="/files/Canp6dk8Pe4SUUIVlrKK" alt=""><figcaption></figcaption></figure>

### Configure Pruning

{% hint style="warning" %}
Before configuring index pruning, ensure the subgraph is deployed.
{% endhint %}

To configure index data pruning for a subgraph, follow these steps:

1. Click the **Configure Pruning** button, a modal window will appear.
2. Set desired **History Blocks**. ( The minimum value must be set at 500, while the maximum value should align with the current block of the subgraph. )
3. To prune once, select the **Prune Once** checkbox (Repruning will not occur); otherwise, leave it unselected.
4. Click the **Confirm** button to configure index data pruning, or click **Close** button to dismiss the modal without making changes.

<figure><img src="/files/edqMhV8xlruyAThEBqMq" alt=""><figcaption></figcaption></figure>

This will initiate the process to configure index data pruning on the subgraph.

<figure><img src="/files/iXKucojO1CI7yXfCRg7D" alt=""><figcaption></figcaption></figure>

Once the index data pruning is configured you will be notified via in-app notification and see this on the dashboard.

<figure><img src="/files/Dehxqy5bXamiN1NIqqpR" alt=""><figcaption></figcaption></figure>

### Deconfigure Pruning

To deconfigure index data pruning for a subgraph, follow these steps:

1. Click the **Deconfigure** button, a modal window will appear.
2. Click the **Yes** button to deconfigure index data pruning, or click **No** button to dismiss the modal.

<figure><img src="/files/9e9LhnQfj7NQDoOsao9M" alt=""><figcaption></figcaption></figure>
