From 7cf069ddfda20fa49e386681a070f3a1f60ec0cb Mon Sep 17 00:00:00 2001
From: Aliaksandr Valialkin <valyala@victoriametrics.com>
Date: Fri, 29 Oct 2021 14:02:45 +0300
Subject: [PATCH] docs/Articles.md: add a link to
 https://valyala.medium.com/how-to-optimize-promql-and-metricsql-queries-85a1b75bf986

---
 docs/Articles.md | 1 +
 docs/FAQ.md      | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/docs/Articles.md b/docs/Articles.md
index 073341925c..d74c7f9771 100644
--- a/docs/Articles.md
+++ b/docs/Articles.md
@@ -86,6 +86,7 @@ See also [case studies](https://docs.victoriametrics.com/CaseStudies.html).
 ### Tutorials, guides and how-to articles
 
 * [PromQL tutorial for beginners and humans](https://valyala.medium.com/promql-tutorial-for-beginners-9ab455142085)
+* [How to optimize PromQL and MetricsQL queries](https://valyala.medium.com/how-to-optimize-promql-and-metricsql-queries-85a1b75bf986)
 * [Analyzing Prometheus data with external tools](https://valyala.medium.com/analyzing-prometheus-data-with-external-tools-5f3e5e147639)
 * [Prometheus Subqueries in VictoriaMetrics](https://valyala.medium.com/prometheus-subqueries-in-victoriametrics-9b1492b720b3)
 * [How to migrate data from Prometheus to VictoriaMetrics](https://medium.com/@romanhavronenko/victoriametrics-how-to-migrate-data-from-prometheus-d44a6728f043)
diff --git a/docs/FAQ.md b/docs/FAQ.md
index cdaecef68d..0d373f76bd 100644
--- a/docs/FAQ.md
+++ b/docs/FAQ.md
@@ -286,6 +286,11 @@ High cardinality usually means high number of [active time series](#what-is-acti
 VictoriaMetrics maintains in-memory cache for mapping of [active time series](#what-is-active-time-series) into internal series ids. The cache size depends on the available memory for VictoriaMetrics in the host system. If the information about all the active time series doesn't fit the cache, then VictoriaMetrics needs to read and unpack the information from disk on every incoming sample for time series missing in the cache. This operation is much slower than the cache lookup, so such insert is named `slow insert`. High percentage of slow inserts on the [official dashboard for VictoriaMetrics](https://docs.victoriametrics.com/#monitoring) indicates on memory shortage for the current number of [active time series](#what-is-active-time-series). Such a condition usually leads to significant slowdown for data ingestion, to significantly increased disk IO and CPU usage. The solution is to add more memory or to reduce the number of [active time series](#what-is-active-time-series). The `/api/v1/status/tsdb` page can be helpful for locating the source of high number of active time seriess - see [these docs](https://docs.victoriametrics.com/#tsdb-stats).
 
 
+## How to optimize MetricsQL query?
+
+See [this article](https://valyala.medium.com/how-to-optimize-promql-and-metricsql-queries-85a1b75bf986).
+
+
 ## Why MetricsQL isn't 100% compatible with PromQL?
 
 [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html) provides better user experience than PromQL. It fixes a few annoying issues in PromQL. This prevents MetricsQL to be 100% compatible with PromQL. See [this article](https://medium.com/@romanhavronenko/victoriametrics-promql-compliance-d4318203f51e) for details.