Skip to content

Commit dc53392

Browse files
authored
add information about column order in monolith (#6094)
1 parent e5ee6bf commit dc53392

File tree

6 files changed

+62
-5
lines changed

6 files changed

+62
-5
lines changed

content/influxdb3/core/write-data/best-practices/optimize-writes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ source: /shared/influxdb3-write-guides/best-practices/optimize-writes.md
1616
---
1717

1818
<!--
19-
The content for this page is at content/shared/influxdb3-write-guides/best-practices/optimize-writes.md
19+
The content for this page is at
20+
//SOURCE content/shared/influxdb3-write-guides/best-practices/optimize-writes.md
2021
-->

content/influxdb3/core/write-data/best-practices/schema-design.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ source: /shared/influxdb3-write-guides/best-practices/schema-design.md
1616
---
1717

1818
<!--
19-
The content for this page is at content/shared/influxdb3-write-guides/best-practices/schema-design.md
19+
The content for this page is at
20+
//SOURCE content/shared/influxdb3-write-guides/best-practices/schema-design.md
2021
-->

content/influxdb3/enterprise/write-data/best-practices/optimize-writes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ source: /shared/influxdb3-write-guides/best-practices/optimize-writes.md
1616
---
1717

1818
<!--
19-
The content for this page is at content/shared/influxdb3-write-guides/best-practices/optimize-writes.md
19+
The content for this page is at
20+
//SOURCE content/shared/influxdb3-write-guides/best-practices/optimize-writes.md
2021
-->

content/influxdb3/enterprise/write-data/best-practices/schema-design.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ source: /shared/influxdb3-write-guides/best-practices/schema-design.md
1616
---
1717

1818
<!--
19-
The content for this page is at content/shared/influxdb3-write-guides/best-practices/schema-design.md
19+
The content for this page is at
20+
//SOURCE content/shared/influxdb3-write-guides/best-practices/schema-design.md
2021
-->

content/shared/influxdb3-write-guides/best-practices/optimize-writes.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ Use these tips to optimize performance and system overhead when writing data to
33
{{< product-name >}}.
44

55
- [Batch writes](#batch-writes)
6-
- [Sort tags by key](#sort-tags-by-key)
6+
{{% hide-in "enterprise,core" %}}- [Sort tags by key](#sort-tags-by-key){{% /hide-in %}}
7+
{{% show-in "enterprise,core" %}}- [On first write, sort tags by query priority](#on-first-write-sort-tags-by-query-priority){{% /show-in %}}
78
- [Use the coarsest time precision possible](#use-the-coarsest-time-precision-possible)
89
- [Use gzip compression](#use-gzip-compression)
910
- [Enable gzip compression in Telegraf](#enable-gzip-compression-in-telegraf)
@@ -34,6 +35,8 @@ Write data in batches to minimize network overhead when writing data to InfluxDB
3435
> The optimal batch size is 10,000 lines of line protocol or 10 MBs, whichever
3536
> threshold is met first.
3637
38+
{{% hide-in "enterprise,core" %}}
39+
3740
## Sort tags by key
3841

3942
Before writing data points to InfluxDB, sort tags by key in lexicographic order.
@@ -49,6 +52,31 @@ measurement,tagC=therefore,tagE=am,tagA=i,tagD=i,tagB=think fieldKey=fieldValue
4952
measurement,tagA=i,tagB=think,tagC=therefore,tagD=i,tagE=am fieldKey=fieldValue 1562020262
5053
```
5154

55+
{{% /hide-in %}}
56+
57+
{{% show-in "enterprise,core" %}}
58+
59+
## On first write, sort tags by query priority
60+
61+
The first write to a table in {{% product-name %}} determines the physical column
62+
order in storage, and that order has a direct impact on query performance.
63+
Columns that appear earlier are typically faster to filter and access during
64+
query execution.
65+
66+
Sort your tags by query priority when performing the initial write to a table.
67+
Place the most commonly queried tags first—those you frequently use in `WHERE`
68+
clauses or joins—followed by less frequently queried ones. For example, if most
69+
of your queries filter by `region` and then by `host`, structure your first
70+
write so that `region` comes before `host`.
71+
72+
> [!Important]
73+
> Column order is determined on the first write and cannot be changed afterward.
74+
> Tags added after the first write are added last in the column sort order.
75+
> Plan your schema with your query workload in mind to ensure the best long-term
76+
> performance.
77+
78+
{{% /show-in %}}
79+
5280
## Use the coarsest time precision possible
5381

5482
{{< product-name >}} supports up to nanosecond timestamp precision. However,

content/shared/influxdb3-write-guides/best-practices/schema-design.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ for simpler and more performant queries.
99
- [Do not use duplicate names for tags and fields](#do-not-use-duplicate-names-for-tags-and-fields)
1010
- [Maximum number of columns per table](#maximum-number-of-columns-per-table)
1111
- [Design for performance](#design-for-performance)
12+
{{% show-in "enterprise,core" %}}- [Sort tags by query priority](#sort-tags-by-query-priority){{% /show-in %}}
1213
- [Avoid wide schemas](#avoid-wide-schemas)
1314
- [Avoid sparse schemas](#avoid-sparse-schemas)
1415
- [Table schemas should be homogenous](#table-schemas-should-be-homogenous)
@@ -135,11 +136,35 @@ the performance of queries against that table.
135136

136137
The following guidelines help to optimize query performance:
137138

139+
{{% show-in "enterprise,core" %}}- [Sort tags by query priority](#sort-tags-by-query-priority){{% /show-in %}}
138140
- [Avoid wide schemas](#avoid-wide-schemas)
139141
- [Avoid sparse schemas](#avoid-sparse-schemas)
140142
- [Table schemas should be homogenous](#table-schemas-should-be-homogenous)
141143
- [Use the best data type for your data](#use-the-best-data-type-for-your-data)
142144

145+
{{% show-in "enterprise,core" %}}
146+
147+
### Sort tags by query priority
148+
149+
The first write to a table in {{% product-name %}} determines the physical column
150+
order in storage, and that order has a direct impact on query performance.
151+
Columns that appear earlier are typically faster to filter and access during
152+
query execution.
153+
154+
Sort your tags by query priority when performing the initial write to a table.
155+
Place the most commonly queried tags first—those you frequently use in `WHERE`
156+
clauses or joins—followed by less frequently queried ones. For example, if most
157+
of your queries filter by `region` and then by `host`, structure your first
158+
write so that `region` comes before `host`.
159+
160+
> [!Important]
161+
> Column order is determined on the first write and cannot be changed afterward.
162+
> Tags added after the first write are added last in the column sort order.
163+
> Plan your schema with your query workload in mind to ensure the best long-term
164+
> performance.
165+
166+
{{% /show-in %}}
167+
143168
### Avoid wide schemas
144169

145170
A wide schema refers to a schema with a large number of columns (tags and fields).

0 commit comments

Comments
 (0)