From 77d3921d020b4ff1a9bd4d1aa5a641ab8737f791 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 2 Aug 2021 11:01:52 -0600 Subject: [PATCH] fixed note block (#2960) --- .../influxdb/v1.8/concepts/key_concepts.md | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/content/influxdb/v1.8/concepts/key_concepts.md b/content/influxdb/v1.8/concepts/key_concepts.md index c75ab4640..16ef2780b 100644 --- a/content/influxdb/v1.8/concepts/key_concepts.md +++ b/content/influxdb/v1.8/concepts/key_concepts.md @@ -118,19 +118,22 @@ Avoid using the following reserved keys: If reserved keys are included as a tag or field key, the associated point is discarded. -> **Why indexing matters: The schema case study** +{{% note %}} +#### Why indexing matters: The schema case study -> Say you notice that most of your queries focus on the values of the field keys `honeybees` and `butterflies`: +Say you notice that most of your queries focus on the values of the field keys `honeybees` and `butterflies`: -> `SELECT * FROM "census" WHERE "butterflies" = 1` -> `SELECT * FROM "census" WHERE "honeybees" = 23` +```sql +SELECT * FROM "census" WHERE "butterflies" = 1 +SELECT * FROM "census" WHERE "honeybees" = 23 +``` -> Because fields aren't indexed, InfluxDB scans every value of `butterflies` in the first query and every value of `honeybees` in the second query before it provides a response. +Because fields aren't indexed, InfluxDB scans every value of `butterflies` in the first query and every value of `honeybees` in the second query before it provides a response. That behavior can hurt query response times - especially on a much larger scale. To optimize your queries, it may be beneficial to rearrange your [schema](/influxdb/v1.8/concepts/glossary/#schema) such that the fields (`butterflies` and `honeybees`) become the tags and the tags (`location` and `scientist`) become the fields: -> **name:** census -> +**name:** census + | time | location | scientist | butterflies | honeybees | | ---- | --------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -------------------------------------------------------------------- | | 2015-08-18T00:00:00Z | 1 | langstroth | 12 | 23 | @@ -142,7 +145,8 @@ To optimize your queries, it may be beneficial to rearrange your [schema](/influ | 2015-08-18T06:06:00Z | 2 | perpetua | 8 | 23 | | 2015-08-18T06:12:00Z | 2 | perpetua | 7 | 22 | -> Now that `butterflies` and `honeybees` are tags, InfluxDB won't have to scan every one of their values when it performs the queries above - this means that your queries are even faster. +Now that `butterflies` and `honeybees` are tags, InfluxDB won't have to scan every one of their values when it performs the queries above - this means that your queries are even faster. +{{% /note %}} The _**measurement**_ acts as a container for tags, fields, and the `time` column, and the measurement name is the description of the data that are stored in the associated fields. Measurement names are strings, and, for any SQL users out there, a measurement is conceptually similar to a table.