---
title: Cache distinct values
description: The Distinct Value Cache (DVC) lets you cache distinct values of one or more columns in a table, improving the performance of queries that return distinct tag and field values. The DVC is an in-memory cache that stores distinct values for specific columns in a table. When you create a DVC, you can specify what columns’ distinct values to cache, the maximum number of distinct value combinations to cache, and the maximum age of cached values. A DVC is associated with a table, which can have multip
url: https://docs.influxdata.com/influxdb3/core/api/cache-distinct-values/
estimated_tokens: 2488
product: InfluxDB 3 Core
version: core
---

[Download InfluxDB 3 Core API Spec](/openapi/influxdb3-core-openapi.yml)

The Distinct Value Cache (DVC) lets you cache distinct values of one or more columns in a table, improving the performance of queries that return distinct tag and field values.

The DVC is an in-memory cache that stores distinct values for specific columns in a table. When you create a DVC, you can specify what columns’ distinct values to cache, the maximum number of distinct value combinations to cache, and the maximum age of cached values. A DVC is associated with a table, which can have multiple DVCs.

POST `/api/v3/configure/distinct_cache`

### Create distinct cache

Creates a distinct cache for a table.

#### Request body required

Content-Type: `application/json`

`columns` required string\[\]

`db` required string

`max_age` integer

Optional maximum age in seconds.

`max_cardinality` integer

Optional maximum cardinality.

`name` string

Optional cache name.

`table` required string

Example request body

```json
{
  "columns": [
    "tag1",
    "tag2"
  ],
  "db": "mydb",
  "max_age": 3600,
  "max_cardinality": 1000,
  "table": "mytable"
}
```

Example request [Ask AI about this](#)

```sh
curl --request POST \
  "https://localhost:8181/api/v3/configure/distinct_cache" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: application/json" \
  --data-raw '{"columns":["tag1","tag2"],"db":"mydb","max_age":3600,"max_cardinality":1000,"table":"mytable"}'
```

#### Responses

201 Success. The distinct cache has been created.

400

Bad request.

The server responds with status `400` if the request would overwrite an existing cache with a different configuration.

409 Conflict. A distinct cache with this configuration already exists.

DELETE `/api/v3/configure/distinct_cache`

### Delete distinct cache

Deletes a distinct cache.

#### Parameters

##### Query parameters

`db` required string

The name of the database.

`table` required string

The name of the table containing the distinct cache.

`name` required string

The name of the distinct cache to delete.

Example request [Ask AI about this](#)

```sh
curl --request DELETE \
  "https://localhost:8181/api/v3/configure/distinct_cache?db=DB&table=TABLE&name=NAME" \
  --header "Authorization: Bearer INFLUX_TOKEN"
```

#### Responses

200 Success. The distinct cache has been deleted.

400 Bad request.

401 Unauthorized access.

`data` object

`error` string

404 Cache not found.

#### Related

-   [Manage the Distinct Value Cache](/influxdb3/core/admin/distinct-value-cache/)
-   [InfluxDB 3 API client libraries](/influxdb3/core/reference/client-libraries/v3/)
