Skip to content

Commit d66e3b5

Browse files
Update approx_topk docs (#94)
* update approx_topk page and restructure SQL References by creating individual function pages under /sql-functions folder * address review comments on sql functions pages * update the approx_topk_distinct documentation * fix metadata issue and remove old sql-references page from .pages
1 parent 79a7a74 commit d66e3b5

File tree

7 files changed

+9
-16
lines changed

7 files changed

+9
-16
lines changed

docs/.pages

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ nav:
55
- Features: features
66
- Enterprise Edition Installation Guide: openobserve-enterprise-edition-installation-guide.md
77
- Releases: releases.md
8+
- SQL Functions: sql-functions
89
- Example Queries: example-queries.md
9-
- SQL Function Reference: sql_reference.md
1010
- HA Deployment: ha_deployment.md
1111
- Environment Variables: environment-variables.md
1212
- Data Management: data-management
@@ -22,4 +22,4 @@ nav:
2222
- Telemetry: telemetry.md
2323
- zPlane: zplane.md
2424
- Work Group: work_group.md
25-
- SQL Functions: sql-functions
25+

docs/sql-functions/aggregate.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
21
---
32
title: histogram() Function in OpenObserve
4-
description: This page explains how to use the histogram() function in OpenObserve to group time-based log data into fixed intervals for trend analysis. It includes syntax options with or without interval specification, use with aggregate functions such as COUNT(), and guidance on interpreting the result. A detailed example shows how logs are grouped into 30-second time buckets, along with the output format. Users are advised to specify intervals explicitly to ensure consistent and predictable results. The page also includes a visual example to support understanding.
3+
description: This page explains how to use the histogram() function in OpenObserve to group time-based log data into fixed intervals for trend analysis. It includes syntax options with or without interval specification, use with aggregate functions such as COUNT(), and guidance on interpreting the result. A detailed example shows how logs are grouped into 30-second time buckets, along with the output format.
54
---
6-
75
Aggregate functions compute a single result from a set of input values. For usage of standard SQL aggregate functions such as `COUNT`, `SUM`, `AVG`, `MIN`, and `MAX`, refer to [PostgreSQL documentation](https://www.postgresql.org/docs/).
86

9-
---
107

118
### `histogram`
129
**Syntax**: histogram(field) or histogram(field, 'interval')

docs/sql-functions/approximate-aggregate/approx-topk-distinct.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
title: approx_topk_distinct() Function in OpenObserve
33
description: This page explains how to use the approx_topk_distinct() function in OpenObserve to identify the top K values in one field based on the highest number of distinct values in another field. It introduces the combined use of HyperLogLog and Space-Saving algorithms to efficiently process large, high-cardinality datasets. The guide includes SQL syntax, a usage example, and demonstrates how to flatten the result using the unnest() function. It also provides a sample output to help users understand the structure and interpretation of the result. For top values based only on frequency, refer to the approx_topk() function.
44
---
5-
65
This page provides instructions on using the `approx_topk_distinct()` function.
76
If you only need to find the top K most frequently occurring values in a field, refer to the [approx_topk()](../approx-topk/) function.
87

@@ -75,8 +74,9 @@ For details on how this approach compares to traditional GROUP BY queries in ter
7574
## Limitations
7675
The following are the known limitations of `approx_topk_distinct()` function:
7776

78-
Results are approximate, not guaranteed to be exact. Not recommended when exact accuracy is critical for analysis or reporting.
79-
Accuracy depends on data distribution across partitions.
8077

81-
![approx_topk_distinct](../../images/approx-topk-distinct.png)
78+
- Results are approximate, not guaranteed to be exact.
79+
- Accuracy depends on data distribution across partitions.
80+
81+
8282

docs/sql-functions/approximate-aggregate/approx-topk.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
21
---
32
title: approx_topk() Function in OpenObserve
4-
description: This page explains how to use the approx_topk() function in OpenObserve to identify the most frequent values in high-cardinality fields. It provides the SQL syntax, a usage example, result structure, and comparison with the traditional GROUP BY approach. The guide includes a detailed performance comparison and highlights memory efficiency in distributed query processing. It also demonstrates how to use approx_topk() with unnest() for flat output and explains scenarios where this function offers a practical advantage. Limitations and frequently asked questions are included to help users understand when to use this approximate method.
3+
description: This page explains how to use the approx_topk() function in OpenObserve to identify the most frequent values in high-cardinality fields. It provides the SQL syntax, a usage example, result structure, and comparison with the traditional GROUP BY approach. The guide includes a detailed performance comparison and highlights memory efficiency in distributed query processing.
54
---
6-
75
This page provides instructions on using the `approx_topk()` function and explains its performance benefits compared to the traditional `GROUP BY` method.
86

97
## What is `approx_topk`?

docs/sql-functions/approximate-aggregate/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ Learn more:
44

55
- [approx_topk](../approximate-aggregate/approx-topk/)
66
- [approx_topk_distinct](../approximate-aggregate/approx-topk-distinct/)
7+

docs/sql-functions/array.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
title: Array Functions in OpenObserve
33
description: This page lists all supported array functions in OpenObserve, along with their syntax, descriptions, and usage examples. These functions operate on fields that contain stringified JSON arrays, enabling users to sort, count, extract subsets, join, and combine array elements. Functions such as arrsort, arrjoin, arrindex, arrzip, spath, and cast_to_arr help process and transform array data effectively.
44
---
5-
65
This page lists the array functions supported in OpenObserve, along with their usage formats, descriptions, and examples.
76

87
The array functions operate on fields that contain arrays. In OpenObserve, array fields are typically stored as stringified JSON arrays.

docs/sql-functions/full-text-search.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
title: Full-Text Search Functions in OpenObserve
33
description: This page describes the full-text search functions supported in OpenObserve, including their syntax, behavior, and examples. Functions such as str_match, str_match_ignore_case, match_all, re_match, and re_not_match allow users to filter logs based on exact string matches, case-insensitive searches, keyword searches across multiple fields, and pattern-based filtering using regular expressions. The guide also explains the role of inverted indexing and how to enable it for enhanced search coverage. Sample queries and output visuals are provided to help users apply these functions effectively in log analysis.
44
---
5-
65
The full-text search functions allow you to filter records based on keyword or pattern matches within one or more fields. <br>This page lists the full-text search functions supported in OpenObserve, along with their usage formats, descriptions, and examples.
76

8-
---
97

108
### `str_match`
119

0 commit comments

Comments
 (0)