From ebe1ec9750e510e4f3398a964d488e31b27acab1 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Fri, 29 Aug 2025 08:44:59 -0600 Subject: [PATCH] InfluxDB 3 Explorer 1.2 (#6350) * feat(explorer): WIP cache management docs * feat(explorer): add cache management guides, fix js bugs * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- assets/js/custom-timestamps.js | 86 +++++++++++-------- .../core/admin/distinct-value-cache/_index.md | 1 + .../core/admin/distinct-value-cache/create.md | 1 + .../core/admin/distinct-value-cache/delete.md | 1 + .../core/admin/distinct-value-cache/query.md | 1 + .../core/admin/distinct-value-cache/show.md | 2 + .../core/admin/last-value-cache/_index.md | 1 + .../core/admin/last-value-cache/create.md | 1 + .../core/admin/last-value-cache/delete.md | 1 + .../core/admin/last-value-cache/query.md | 1 + .../core/admin/last-value-cache/show.md | 2 + .../admin/distinct-value-cache/_index.md | 1 + .../admin/distinct-value-cache/create.md | 1 + .../admin/distinct-value-cache/delete.md | 1 + .../admin/distinct-value-cache/query.md | 1 + .../admin/distinct-value-cache/show.md | 2 + .../admin/last-value-cache/_index.md | 1 + .../admin/last-value-cache/create.md | 1 + .../admin/last-value-cache/delete.md | 1 + .../admin/last-value-cache/query.md | 1 + .../enterprise/admin/last-value-cache/show.md | 2 + .../explorer/manage-caches/_index.md | 21 +++++ .../manage-caches/distinct-value-caches.md | 72 ++++++++++++++++ .../manage-caches/last-value-caches.md | 74 ++++++++++++++++ .../influxdb3-sample-data/sample-data.md | 17 ++-- .../footer/widgets/custom-time-trigger.html | 2 +- 26 files changed, 249 insertions(+), 47 deletions(-) create mode 100644 content/influxdb3/explorer/manage-caches/_index.md create mode 100644 content/influxdb3/explorer/manage-caches/distinct-value-caches.md create mode 100644 content/influxdb3/explorer/manage-caches/last-value-caches.md diff --git a/assets/js/custom-timestamps.js b/assets/js/custom-timestamps.js index 3cde0a6ad..e4411ee25 100644 --- a/assets/js/custom-timestamps.js +++ b/assets/js/custom-timestamps.js @@ -43,7 +43,7 @@ function getStartDate() { //////////////////////////////////////////////////////////////////////////////// -// If the user has not set the startDate cookie, default the startDate to yesterday +// If the user has not set the startDate cookie, default startDate to yesterday var startDate = getStartDate() || yesterday(); // Convert a time value to a Unix timestamp (seconds) @@ -109,6 +109,49 @@ const defaultTimes = [ }, // 1641067200 ]; +// Helper function to update text while preserving code placeholder elements +function updateTextNode(node, times) { + if (node.nodeType === Node.TEXT_NODE) { + let text = node.textContent; + times.forEach(function (x) { + const oldDatePart = datePart(x.rfc3339.replace(/T.*$/, '')); + const newDatePart = datePart(x.rfc3339_new.replace(/T.*$/, '')); + const rfc3339Regex = new RegExp( + `${oldDatePart.year}(.*?)${oldDatePart.month}(.*?)${oldDatePart.day}`, + 'g' + ); + const rfc3339Repl = `${newDatePart.year}$1${newDatePart.month}$2${newDatePart.day}`; + + text = text + .replaceAll(x.unix, x.unix_new) + .replace(rfc3339Regex, rfc3339Repl); + }); + node.textContent = text; + } +} + +// Recursively update timestamps in DOM while preserving structure +function updateTimestampsInElement(element, times) { + // Skip code placeholder elements to preserve their functionality + if (element.classList && element.classList.contains('code-placeholder')) { + return; + } + + // Skip elements with data-component attribute (preserves all components) + if (element.hasAttribute && element.hasAttribute('data-component')) { + return; + } + + const childNodes = Array.from(element.childNodes); + childNodes.forEach((child) => { + if (child.nodeType === Node.TEXT_NODE) { + updateTextNode(child, times); + } else if (child.nodeType === Node.ELEMENT_NODE) { + updateTimestampsInElement(child, times); + } + }); +} + function updateTimestamps(newStartDate, seedTimes = defaultTimes) { // Update the times array with replacement times const times = seedTimes.map((x) => { @@ -129,40 +172,14 @@ function updateTimestamps(newStartDate, seedTimes = defaultTimes) { '.custom-timestamps table', ]; + // Update block elements while preserving DOM structure $(updateBlockElWhitelist.join()).each(function () { - var wrapper = $(this)[0]; - - times.forEach(function (x) { - const oldDatePart = datePart(x.rfc3339.replace(/T.*$/, '')); - const newDatePart = datePart(x.rfc3339_new.replace(/T.*$/, '')); - const rfc3339Regex = new RegExp( - `${oldDatePart.year}(.*?)${oldDatePart.month}(.*?)${oldDatePart.day}`, - 'g' - ); - const rfc3339Repl = `${newDatePart.year}$1${newDatePart.month}$2${newDatePart.day}`; - - wrapper.innerHTML = wrapper.innerHTML - .replaceAll(x.unix, x.unix_new) - .replaceAll(rfc3339Regex, rfc3339Repl); - }); + updateTimestampsInElement(this, times); }); + // Update span elements $('span.custom-timestamps').each(function () { - var wrapper = $(this)[0]; - - times.forEach(function (x) { - const oldDatePart = datePart(x.rfc3339.replace(/T.*$/, '')); - const newDatePart = datePart(x.rfc3339_new.replace(/T.*$/, '')); - const rfc3339Regex = new RegExp( - `${oldDatePart.year}-${oldDatePart.month}-${oldDatePart.day}`, - 'g' - ); - const rfc3339Repl = `${newDatePart.year}-${newDatePart.month}-${newDatePart.day}`; - - wrapper.innerHTML = wrapper.innerHTML - .replaceAll(x.unix, x.unix_new) - .replaceAll(rfc3339Regex, rfc3339Repl); - }); + updateTimestampsInElement(this, times); }); // Create a new seed times array with new start time for next change @@ -196,10 +213,11 @@ function CustomTimeTrigger({ component }) { prevArrow: '<', }); - //////////////////////////////////// ACTIONS /////////////////////////////////// + /////////////////////////////////// ACTIONS ////////////////////////////////// - // Initial update to yesterdays date ON PAGE LOAD - // Conditionally set the start date cookie it startDate is equal to the default value + // Initial update to yesterday's date ON PAGE LOAD + // Conditionally set the start date cookie if startDate is equal to the + // default value let updatedTimes = updateTimestamps(startDate, defaultTimes); if (startDate === yesterday()) { diff --git a/content/influxdb3/core/admin/distinct-value-cache/_index.md b/content/influxdb3/core/admin/distinct-value-cache/_index.md index 5e9004280..7d21ca602 100644 --- a/content/influxdb3/core/admin/distinct-value-cache/_index.md +++ b/content/influxdb3/core/admin/distinct-value-cache/_index.md @@ -12,6 +12,7 @@ weight: 105 influxdb3/core/tags: [cache] related: - /influxdb3/core/reference/sql/functions/cache/#distinct_cache, distinct_cache SQL function + - /influxdb3/explorer/manage-caches/distinct-value-caches/ source: /shared/influxdb3-admin/distinct-value-cache/_index.md --- diff --git a/content/influxdb3/core/admin/distinct-value-cache/create.md b/content/influxdb3/core/admin/distinct-value-cache/create.md index cda0d9ccd..038dbf0c2 100644 --- a/content/influxdb3/core/admin/distinct-value-cache/create.md +++ b/content/influxdb3/core/admin/distinct-value-cache/create.md @@ -10,6 +10,7 @@ weight: 201 influxdb3/core/tags: [cache] related: - /influxdb3/core/reference/cli/influxdb3/create/distinct_cache/ + - /influxdb3/explorer/manage-caches/distinct-value-caches/ list_code_example: | {{% show-in "core" %}} diff --git a/content/influxdb3/core/admin/distinct-value-cache/delete.md b/content/influxdb3/core/admin/distinct-value-cache/delete.md index ffbfb1374..02aeb00e0 100644 --- a/content/influxdb3/core/admin/distinct-value-cache/delete.md +++ b/content/influxdb3/core/admin/distinct-value-cache/delete.md @@ -20,6 +20,7 @@ list_code_example: | ``` related: - /influxdb3/core/reference/cli/influxdb3/delete/distinct_cache/ + - /influxdb3/explorer/manage-caches/distinct-value-caches/ source: /shared/influxdb3-admin/distinct-value-cache/delete.md --- diff --git a/content/influxdb3/core/admin/distinct-value-cache/query.md b/content/influxdb3/core/admin/distinct-value-cache/query.md index ea499869e..8cf6f21a4 100644 --- a/content/influxdb3/core/admin/distinct-value-cache/query.md +++ b/content/influxdb3/core/admin/distinct-value-cache/query.md @@ -19,6 +19,7 @@ list_code_example: | > InfluxQL does not support the `distinct_cache()` function. related: - /influxdb3/core/reference/sql/functions/cache/#distinct_cache, distinct_cache SQL function + - /influxdb3/explorer/manage-caches/distinct-value-caches/ source: /shared/influxdb3-admin/distinct-value-cache/query.md --- diff --git a/content/influxdb3/core/admin/distinct-value-cache/show.md b/content/influxdb3/core/admin/distinct-value-cache/show.md index 5cd73312a..a596d2464 100644 --- a/content/influxdb3/core/admin/distinct-value-cache/show.md +++ b/content/influxdb3/core/admin/distinct-value-cache/show.md @@ -18,6 +18,8 @@ list_code_example: | --token 00xoXX0xXXx0000XxxxXx0Xx0xx0 \ table distinct_caches ``` +related: + - /influxdb3/explorer/manage-caches/distinct-value-caches/ source: /shared/influxdb3-admin/distinct-value-cache/show.md --- diff --git a/content/influxdb3/core/admin/last-value-cache/_index.md b/content/influxdb3/core/admin/last-value-cache/_index.md index 2560c1ead..e0b68978d 100644 --- a/content/influxdb3/core/admin/last-value-cache/_index.md +++ b/content/influxdb3/core/admin/last-value-cache/_index.md @@ -13,6 +13,7 @@ weight: 104 influxdb3/core/tags: [cache] related: - /influxdb3/core/reference/sql/functions/cache/#last_cache, last_cache SQL function + - /influxdb3/explorer/manage-caches/last-value-caches/ source: /shared/influxdb3-admin/last-value-cache/_index.md --- diff --git a/content/influxdb3/core/admin/last-value-cache/create.md b/content/influxdb3/core/admin/last-value-cache/create.md index 6a6d98b4a..2cca8a876 100644 --- a/content/influxdb3/core/admin/last-value-cache/create.md +++ b/content/influxdb3/core/admin/last-value-cache/create.md @@ -10,6 +10,7 @@ weight: 201 influxdb3/core/tags: [cache] related: - /influxdb3/core/reference/cli/influxdb3/create/last_cache/ + - /influxdb3/explorer/manage-caches/last-value-caches/ list_code_example: | {{% show-in "core" %}} diff --git a/content/influxdb3/core/admin/last-value-cache/delete.md b/content/influxdb3/core/admin/last-value-cache/delete.md index db0060262..df0032d47 100644 --- a/content/influxdb3/core/admin/last-value-cache/delete.md +++ b/content/influxdb3/core/admin/last-value-cache/delete.md @@ -20,6 +20,7 @@ list_code_example: | ``` related: - /influxdb3/core/reference/cli/influxdb3/delete/last_cache/ + - /influxdb3/explorer/manage-caches/last-value-caches/ source: /shared/influxdb3-admin/last-value-cache/delete.md --- diff --git a/content/influxdb3/core/admin/last-value-cache/query.md b/content/influxdb3/core/admin/last-value-cache/query.md index a634d3600..5d5e1ae4c 100644 --- a/content/influxdb3/core/admin/last-value-cache/query.md +++ b/content/influxdb3/core/admin/last-value-cache/query.md @@ -19,6 +19,7 @@ list_code_example: | > InfluxQL does not support the `last_cache()` function. related: - /influxdb3/core/reference/sql/functions/cache/#last_cache, last_cache SQL function + - /influxdb3/explorer/manage-caches/last-value-caches/ source: /shared/influxdb3-admin/last-value-cache/query.md --- diff --git a/content/influxdb3/core/admin/last-value-cache/show.md b/content/influxdb3/core/admin/last-value-cache/show.md index 9d66333dd..96d484656 100644 --- a/content/influxdb3/core/admin/last-value-cache/show.md +++ b/content/influxdb3/core/admin/last-value-cache/show.md @@ -18,6 +18,8 @@ list_code_example: | --token 00xoXX0xXXx0000XxxxXx0Xx0xx0 \ table last_caches ``` +related: + - /influxdb3/explorer/manage-caches/last-value-caches/ source: /shared/influxdb3-admin/last-value-cache/show.md --- diff --git a/content/influxdb3/enterprise/admin/distinct-value-cache/_index.md b/content/influxdb3/enterprise/admin/distinct-value-cache/_index.md index 78d4e1762..8e190a678 100644 --- a/content/influxdb3/enterprise/admin/distinct-value-cache/_index.md +++ b/content/influxdb3/enterprise/admin/distinct-value-cache/_index.md @@ -12,6 +12,7 @@ weight: 106 influxdb3/enterprise/tags: [cache] related: - /influxdb3/enterprise/reference/sql/functions/cache/#distinct_cache, distinct_cache SQL function + - /influxdb3/explorer/manage-caches/distinct-value-caches/ source: /shared/influxdb3-admin/distinct-value-cache/_index.md --- diff --git a/content/influxdb3/enterprise/admin/distinct-value-cache/create.md b/content/influxdb3/enterprise/admin/distinct-value-cache/create.md index 51e1ae109..d52eadc46 100644 --- a/content/influxdb3/enterprise/admin/distinct-value-cache/create.md +++ b/content/influxdb3/enterprise/admin/distinct-value-cache/create.md @@ -10,6 +10,7 @@ weight: 201 influxdb3/enterprise/tags: [cache] related: - /influxdb3/enterprise/reference/cli/influxdb3/create/distinct_cache/ + - /influxdb3/explorer/manage-caches/distinct-value-caches/ list_code_example: | {{% show-in "core" %}} diff --git a/content/influxdb3/enterprise/admin/distinct-value-cache/delete.md b/content/influxdb3/enterprise/admin/distinct-value-cache/delete.md index 4ad6f867d..34902649c 100644 --- a/content/influxdb3/enterprise/admin/distinct-value-cache/delete.md +++ b/content/influxdb3/enterprise/admin/distinct-value-cache/delete.md @@ -20,6 +20,7 @@ list_code_example: | ``` related: - /influxdb3/enterprise/reference/cli/influxdb3/delete/distinct_cache/ + - /influxdb3/explorer/manage-caches/distinct-value-caches/ source: /shared/influxdb3-admin/distinct-value-cache/delete.md --- diff --git a/content/influxdb3/enterprise/admin/distinct-value-cache/query.md b/content/influxdb3/enterprise/admin/distinct-value-cache/query.md index aaee0c6f5..fe39c4d67 100644 --- a/content/influxdb3/enterprise/admin/distinct-value-cache/query.md +++ b/content/influxdb3/enterprise/admin/distinct-value-cache/query.md @@ -19,6 +19,7 @@ list_code_example: | > InfluxQL does not support the `distinct_cache()` function. related: - /influxdb3/enterprise/reference/sql/functions/cache/#distinct_cache, distinct_cache SQL function + - /influxdb3/explorer/manage-caches/distinct-value-caches/ source: /shared/influxdb3-admin/distinct-value-cache/query.md --- diff --git a/content/influxdb3/enterprise/admin/distinct-value-cache/show.md b/content/influxdb3/enterprise/admin/distinct-value-cache/show.md index 53fa3a9a3..f3100655e 100644 --- a/content/influxdb3/enterprise/admin/distinct-value-cache/show.md +++ b/content/influxdb3/enterprise/admin/distinct-value-cache/show.md @@ -18,6 +18,8 @@ list_code_example: | --token 00xoXX0xXXx0000XxxxXx0Xx0xx0 \ table distinct_caches ``` +related: + - /influxdb3/explorer/manage-caches/distinct-value-caches/ source: /shared/influxdb3-admin/distinct-value-cache/show.md --- diff --git a/content/influxdb3/enterprise/admin/last-value-cache/_index.md b/content/influxdb3/enterprise/admin/last-value-cache/_index.md index c8221c224..570432067 100644 --- a/content/influxdb3/enterprise/admin/last-value-cache/_index.md +++ b/content/influxdb3/enterprise/admin/last-value-cache/_index.md @@ -13,6 +13,7 @@ weight: 105 influxdb3/enterprise/tags: [cache] related: - /influxdb3/enterprise/reference/sql/functions/cache/#last_cache, last_cache SQL function + - /influxdb3/explorer/manage-caches/last-value-caches/ source: /shared/influxdb3-admin/last-value-cache/_index.md --- diff --git a/content/influxdb3/enterprise/admin/last-value-cache/create.md b/content/influxdb3/enterprise/admin/last-value-cache/create.md index 66940789d..2c9fb6956 100644 --- a/content/influxdb3/enterprise/admin/last-value-cache/create.md +++ b/content/influxdb3/enterprise/admin/last-value-cache/create.md @@ -10,6 +10,7 @@ weight: 201 influxdb3/enterprise/tags: [cache] related: - /influxdb3/enterprise/reference/cli/influxdb3/create/last_cache/ + - /influxdb3/explorer/manage-caches/last-value-caches/ list_code_example: | {{% show-in "core" %}} diff --git a/content/influxdb3/enterprise/admin/last-value-cache/delete.md b/content/influxdb3/enterprise/admin/last-value-cache/delete.md index 9361bf9b0..c515c4027 100644 --- a/content/influxdb3/enterprise/admin/last-value-cache/delete.md +++ b/content/influxdb3/enterprise/admin/last-value-cache/delete.md @@ -20,6 +20,7 @@ list_code_example: | ``` related: - /influxdb3/enterprise/reference/cli/influxdb3/delete/last_cache/ + - /influxdb3/explorer/manage-caches/last-value-caches/ source: /shared/influxdb3-admin/last-value-cache/delete.md --- diff --git a/content/influxdb3/enterprise/admin/last-value-cache/query.md b/content/influxdb3/enterprise/admin/last-value-cache/query.md index e94e85e97..171145439 100644 --- a/content/influxdb3/enterprise/admin/last-value-cache/query.md +++ b/content/influxdb3/enterprise/admin/last-value-cache/query.md @@ -19,6 +19,7 @@ list_code_example: | > InfluxQL does not support the `last_cache()` function. related: - /influxdb3/enterprise/reference/sql/functions/cache/#last_cache, last_cache SQL function + - /influxdb3/explorer/manage-caches/last-value-caches/ source: /shared/influxdb3-admin/last-value-cache/query.md --- diff --git a/content/influxdb3/enterprise/admin/last-value-cache/show.md b/content/influxdb3/enterprise/admin/last-value-cache/show.md index 6e981ed38..231fa6574 100644 --- a/content/influxdb3/enterprise/admin/last-value-cache/show.md +++ b/content/influxdb3/enterprise/admin/last-value-cache/show.md @@ -18,6 +18,8 @@ list_code_example: | --token 00xoXX0xXXx0000XxxxXx0Xx0xx0 \ table last_caches ``` +related: + - /influxdb3/explorer/manage-caches/last-value-caches/ source: /shared/influxdb3-admin/last-value-cache/show.md --- diff --git a/content/influxdb3/explorer/manage-caches/_index.md b/content/influxdb3/explorer/manage-caches/_index.md new file mode 100644 index 000000000..6ae47b24a --- /dev/null +++ b/content/influxdb3/explorer/manage-caches/_index.md @@ -0,0 +1,21 @@ +--- +title: Manage caches with InfluxDB 3 Explorer +seotitle: Manage InfluxDB caches with InfluxDB 3 Explorer +description: > + Use InfluxDB 3 Explorer to manage Last Value Caches and Distinct Value Caches + in an InfluxDB 3 instance or cluster. +menu: + influxdb3_explorer: + name: Manage caches +weight: 6 +related: + - /influxdb3/enterprise/admin/last-value-cache/, Manage the Last Value Cache in InfluxDB 3 Enterprise + - /influxdb3/enterprise/admin/distinct-value-cache/, Manage the Distinct Value Cache in InfluxDB 3 Enterprise + - /influxdb3/core/admin/last-value-cache/, Manage the Last Value Cache in InfluxDB 3 Core + - /influxdb3/core/admin/distinct-value-cache/, Manage the Distinct Value Cache in InfluxDB 3 Core +--- + +Use InfluxDB 3 Explorer to manage Last Value Caches and Distinct Value Caches +in an InfluxDB 3 instance or cluster. + +{{< children >}} diff --git a/content/influxdb3/explorer/manage-caches/distinct-value-caches.md b/content/influxdb3/explorer/manage-caches/distinct-value-caches.md new file mode 100644 index 000000000..a887f1483 --- /dev/null +++ b/content/influxdb3/explorer/manage-caches/distinct-value-caches.md @@ -0,0 +1,72 @@ +--- +title: Manage Distinct Value Caches with InfluxDB 3 Explorer +list_title: Manage Distinct Value Caches +description: > + Use InfluxDB 3 Explorer to manage Distinct Value Caches in an InfluxDB 3 + instance or cluster. +menu: + influxdb3_explorer: + name: Distinct Value Caches + parent: Manage caches +weight: 102 +related: + - /influxdb3/enterprise/admin/distinct-value-cache/, Manage the Distinct Value Cache in InfluxDB 3 Enterprise + - /influxdb3/core/admin/distinct-value-cache/, Manage the Distinct Value Cache in InfluxDB 3 Core +--- + +Use InfluxDB 3 Explorer to manage Distinct Value Caches (DVCs) in an InfluxDB 3 +instance or cluster. To navigate to the **Distinct Value Cache management page**: + +1. In the left navigation bar, select **Configure** > **Caches**. +2. Select the **Distinct Value Caches** tab. + +- [View Distinct Value Caches](#view-distinct-value-caches) +- [Create a Distinct Value Cache](#create-a-distinct-value-cache) +- [Query a Distinct Value Cache](#query-a-distinct-value-cache) +- [Delete a Distinct Value Cache](#delete-a-distinct-value-cache) + +## View Distinct Value Caches + +To view DVCs associated with a database, navigate to the +**Distinct Value Cache management page** and select the database from the +**Select Database** dropdown menu. The page lists all DVCs associated with the +selected database. + +## Create a Distinct Value Cache + +On the **Distinct Value Cache management page**: + +1. Click **+ Create Cache**. +2. Provide the following: + + - **Cache name**: A unique name for the cache. + - **Database**: The database the cache is associated with. + - **Table**: The target table for the cache. As data is written to the table, + it populates the cache. + _You must select a database before you can select a table._ + - **Column names**: Select columns to cache distinct values from. + These are typically InfluxDB tags, but you can also use fields. + combinations to cache. Once this limit is exceeded, InfluxDB drops the oldest cached + distinct values. + - **Max Age**: Specify the maximum age of cached values as a duration in + [humantime](https://docs.rs/humantime/latest/humantime/fn.parse_duration.html) + form. The default is `24h`. + + > [!Note] + > Higher cardinality (more distinct values) in a DVC increases memory usage. + +3. Click **Create**. + +## Query a Distinct Value Cache + +Use the `distinct_cache` SQL function to query a DVC. For more information, see +[Query a Distinct Value Cache](/influxdb3/enterprise/admin/distinct-value-cache/query/). + +## Delete a Distinct Value Cache + +On the **Distinct Value Cache management page**: + +1. Select the database associated with the cache you want to delete from the + **Select Database** dropdown menu. +2. In the **Active Caches** table, click the {{% icon "trash" %}} icon next to + the cache you want to delete. \ No newline at end of file diff --git a/content/influxdb3/explorer/manage-caches/last-value-caches.md b/content/influxdb3/explorer/manage-caches/last-value-caches.md new file mode 100644 index 000000000..89db6c19c --- /dev/null +++ b/content/influxdb3/explorer/manage-caches/last-value-caches.md @@ -0,0 +1,74 @@ +--- +title: Manage Last Value Caches with InfluxDB 3 Explorer +list_title: Manage Last Value Caches +description: > + Use InfluxDB 3 Explorer to manage Last Value Caches in an InfluxDB 3 instance + or cluster. +menu: + influxdb3_explorer: + name: Last Value Caches + parent: Manage caches +weight: 101 +related: + - /influxdb3/enterprise/admin/last-value-cache/, Manage the Last Value Cache in InfluxDB 3 Enterprise + - /influxdb3/core/admin/last-value-cache/, Manage the Last Value Cache in InfluxDB 3 Core +--- + +Use InfluxDB 3 Explorer to manage Last Value Caches (LVCs) in an InfluxDB 3 +instance or cluster. To navigate to the **Last Value Cache management page**, in +the left navigation bar, select **Configure** > **Caches**. + +- [View Last Value Caches](#view-last-value-caches) +- [Create a Last Value Cache](#create-a-last-value-cache) +- [Query a Last Value Cache](#query-a-last-value-cache) +- [Delete a Last Value Cache](#delete-a-last-value-cache) + +## View Last Value Caches + +To view LVCs associated with a database, navigate to the +**Last Value Cache management page** and select the database from the +**Select Database** dropdown menu. The page lists all LVCs associated with the +selected database. + +## Create a Last Value Cache + +On the **Last Value Cache management page**: + +1. Click **+ Create Cache**. +2. Provide the following: + + - **Cache name**: A unique name for the cache. + - **Database**: The database the cache is associated with. + - **Table**: The target table for the cache. As data is written to the table, + it populates the cache. + _You must select a database before you can select a table._ + - **Key columns**: Select string-typed column columns to use as the primary + key for the cache. These are typically InfluxDB tags, but you can also use + fields. Each unique combination of key column values represents a distinct + series. LVCs cache N (count) values per series. + - **Value columns**: Select columns to cache values for. These are + typically InfluxDB fields, but can also be tags. If no columns are + selected as value columns, all non-key columns are used as value columns + (excluding `time`). + - **Count**: Specify the number of recently written values to cache per series. + + > [!Note] + > Higher cardinality (more unique series) in an LVC increases memory usage. + > Be selective about key columns and the number of values to cache per + > series to optimize performance. + +3. Click **Create**. + +## Query a Last Value Cache + +Use the `last_cache` SQL function to query an LVC. For more information, see +[Query a Last Value Cache](/influxdb3/enterprise/admin/last-value-cache/query/). + +## Delete a Last Value Cache + +On the **Last Value Cache management page**: + +1. Select the database associated with the cache you want to delete from the + **Select Database** dropdown menu. +2. In the **Active Caches** table, click the {{% icon "trash" %}} icon next to + the cache you want to delete. diff --git a/content/shared/influxdb3-sample-data/sample-data.md b/content/shared/influxdb3-sample-data/sample-data.md index 213806595..04530e922 100644 --- a/content/shared/influxdb3-sample-data/sample-data.md +++ b/content/shared/influxdb3-sample-data/sample-data.md @@ -53,8 +53,8 @@ home sensor sample data to {{< product-name >}}. {{% code-tab-content %}} {{% influxdb/custom-timestamps %}} -{{% code-placeholders "AUTH_TOKEN|DATABASE_NAME" %}} -```sh + +```bash { placeholders="AUTH_TOKEN|DATABASE_NAME" } influxdb3 write \ --token AUTH_TOKEN \ --database DATABASE_NAME \ @@ -85,15 +85,13 @@ home,room=Kitchen temp=23.1,hum=36.6,co=22i 1641063600 home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1641067200 home,room=Kitchen temp=22.7,hum=36.5,co=26i 1641067200' ``` -{{% /code-placeholders %}} {{% /influxdb/custom-timestamps %}} {{% /code-tab-content %}} {{% code-tab-content %}} {{% influxdb/custom-timestamps %}} -{{% code-placeholders "AUTH_TOKEN|DATABASE_NAME" %}} -```sh +```bash { placeholders="AUTH_TOKEN|DATABASE_NAME" } curl -v "http://localhost:8181/api/v3/write_lp?db=sensors&precision=auto&accept_partial=true" \ --data-raw "home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1735545600 home,room=Kitchen temp=21.0,hum=35.9,co=0i 1735545600 @@ -122,15 +120,13 @@ home,room=Kitchen temp=23.1,hum=36.6,co=22i 1735585200 home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1735588800 home,room=Kitchen temp=22.7,hum=36.5,co=26i 1735588800" ``` -{{% /code-placeholders %}} {{% /influxdb/custom-timestamps %}} {{% /code-tab-content %}} {{% code-tab-content %}} {{% influxdb/custom-timestamps %}} -{{% code-placeholders "AUTH_TOKEN|DATABASE_NAME" %}} -```sh +```bash { placeholders="AUTH_TOKEN|DATABASE_NAME" } curl --request POST \ http://{{< influxdb/host >}}/api/v2/write?bucket=DATABASE_NAME&precision=s \ --header "Authorization: Bearer AUTH_TOKEN" \ @@ -165,15 +161,13 @@ home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1641067200 home,room=Kitchen temp=22.7,hum=36.5,co=26i 1641067200 " ``` -{{% /code-placeholders %}} {{% /influxdb/custom-timestamps %}} {{% /code-tab-content %}} {{% code-tab-content %}} {{% influxdb/custom-timestamps %}} -{{% code-placeholders "AUTH_TOKEN|DATABASE_NAME" %}} -```sh +```bash { placeholders="AUTH_TOKEN|DATABASE_NAME" } curl --request POST \ http://{{< influxdb/host >}}/write?db=DATABASE_NAME&precision=s \ --header "Authorization: Bearer AUTH_TOKEN" \ @@ -207,7 +201,6 @@ home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1641067200 home,room=Kitchen temp=22.7,hum=36.5,co=26i 1641067200 " ``` -{{% /code-placeholders %}} {{% /influxdb/custom-timestamps %}} {{% /code-tab-content %}} diff --git a/layouts/partials/footer/widgets/custom-time-trigger.html b/layouts/partials/footer/widgets/custom-time-trigger.html index 1e10d96f2..378065ef6 100644 --- a/layouts/partials/footer/widgets/custom-time-trigger.html +++ b/layouts/partials/footer/widgets/custom-time-trigger.html @@ -1,6 +1,6 @@ {{ if or (.Page.HasShortcode "influxdb/custom-timestamps") (.Page.HasShortcode "influxdb/custom-timestamps-span") }}
- +