|
1 | 1 | # Overview
|
2 | 2 |
|
| 3 | +Welcome to the user guide for GreptimeDB. |
| 4 | + |
| 5 | +GreptimeDB is the unified time series database for metrics, events, and logs, |
| 6 | +providing real-time insights from Edge to Cloud at any scale. |
| 7 | +This guide will help you explore each powerful feature of GreptimeDB. |
| 8 | + |
| 9 | +## SQL query example |
| 10 | + |
| 11 | +Let's start with a SQL query example. |
| 12 | + |
| 13 | +To monitor the performance and reliability of specific metrics, |
| 14 | +engineers commonly analyze data over time at regular intervals using queries. |
| 15 | +This often involves joining two data sources. |
| 16 | +However, executing a query like the one below was previously impossible, |
| 17 | +which is now possible with GreptimeDB. |
| 18 | + |
| 19 | +```sql |
| 20 | +SELECT |
| 21 | + host, |
| 22 | + approx_percentile_cont(latency, 0.95) RANGE '15s' as p95_latency, |
| 23 | + count(error) RANGE '15s' as num_errors, |
| 24 | +FROM |
| 25 | + metrics INNER JOIN logs on metrics.host = logs.host |
| 26 | +WHERE |
| 27 | + time > now() - INTERVAL '1 hour' AND |
| 28 | + matches(path, '/api/v1/avator') |
| 29 | +ALIGN '5s' BY (host) FILL PREV |
| 30 | +``` |
| 31 | + |
| 32 | +This query analyzes the performance and errors of a specific API path (`/api/v1/avator`) over the past hour. |
| 33 | +It calculates the 95th percentile latency and the number of errors in 15-second intervals and aligns the results to 5-second intervals for continuity and readability. |
| 34 | + |
| 35 | +Break down the query step by step: |
| 36 | + |
| 37 | +1. SELECT clause: |
| 38 | + - `host`: Selects the host field. |
| 39 | + - `approx_percentile_cont(latency, 0.95) RANGE '15s' as p95_latency`: Calculates the 95th percentile of latency within a 15-second range and labels it as p95_latency. |
| 40 | + - `count(error) RANGE '15s' as num_errors`: Counts the number of errors within a 15-second range and labels it as num_errors. |
| 41 | +2. FROM clause: |
| 42 | + - `metrics INNER JOIN logs on metrics.host = logs.host`: Joins the metrics and logs tables on the host field. |
| 43 | +3. WHERE clause: |
| 44 | + - `time > now() - INTERVAL '1 hour'`: Filters the records to include only those from the past hour. |
| 45 | + - `matches(path, '/api/v1/avator')`: Filters the records to include only those matching the path `/api/v1/avator`. |
| 46 | +4. ALIGN clause: |
| 47 | + - `ALIGN '5s' BY (host) FILL PREV`: Aligns the results to every 5 seconds and fills in missing values with the previous non-null value. |
| 48 | + |
| 49 | +Next, let's analyze the key features of GreptimeDB demonstrated by this query example: |
| 50 | + |
| 51 | +- **Unified Storage:** GreptimeDB stores both time-series metrics and [logs](/user-guide/logs/overview.md) in one database. The simplified architecture and data consistency enhances the ability to analyze and troubleshoot issues, and can lead to cost savings and improved system performance. |
| 52 | +- **Unique Data Model:** The unique [data model](/user-guide/concepts/data-model.md) with time index and full-text index greatly improves query performance and has stood the test of large data sets. It not only supports metric [insertion](/user-guide/write-data/overview.md) and [query](/user-guide/query-data/overview.md), but also provides a very friendly way to [write](/user-guide/logs/write-logs.md) and [query](/user-guide/logs/query-logs.md) logs. |
| 53 | +- **Range Queries:** GreptimeDB supports [range queries](/user-guide/query-data/sql#aggregate-data-by-time-window) to evaluate [expressions](/reference/sql/functions/overview.md) over time, providing insights into metric trends. You can also [continuously aggregate](/user-guide/continuous-aggregation/overview) data for further analysis. |
| 54 | +- **SQL and Multiple Protocols:** GreptimeDB uses SQL as the main query language and supports [multiple protocols](/user-guide/clients/overview.md#protocols), which greatly reduces the learning curve and development cost. You can easily migrate from Prometheus or [Influxdb to GreptimeDB](/user-guide/migrate-to-greptimedb/migrate-from-influxdb), or just start with GreptimeDB. |
| 55 | +- **JOIN Operations:** The data model of GreptimeDB's time series tables makes it the first time series database to support [JOIN operations](/reference/sql/join.md). |
| 56 | + |
| 57 | +Having understood these features, you can now go directly to exploring the features that interest you, or continue reading the next step in the sequence. |
| 58 | + |
| 59 | +## Next steps |
| 60 | + |
3 | 61 | * [Concepts](./concepts/overview.md)
|
4 | 62 | * [Clients](./clients/overview.md)
|
5 | 63 | * [Table Management](./table-management.md)
|
| 64 | +* [Migrate to GreptimeDB](./migrate-to-greptimedb/migrate-from-influxdb.md) |
6 | 65 | * [Write data](./write-data/overview.md)
|
7 | 66 | * [Query data](./query-data/overview.md)
|
| 67 | +* [Continuous Aggregation](./continuous-aggregation/overview.md) |
8 | 68 | * [Python Scripts](./python-scripts/overview.md)
|
9 | 69 | * [Operations](./operations/overview.md)
|
10 | 70 | * [Cluster](./cluster.md)
|
0 commit comments