Cloud Dedicated InfluxQL reference (#4959)

* Dedicated InfluxQL function reference, sample data, feature tracking (#4934)

* WIP influxql reference docs

* WIP finished porting InfluxQL aggregate and selector functions

* WIP holt winters

* WIP adding sample data sets to dedicated

* restructured content for influxql technical analysis functions

* added sample data and examples for influxql technical analysis functions

* restructured influxql transformation function docs

* add influxql feature tracking doc with function support

* updated influxql page function descriptions

* added note about missing influxql functions

* Apply suggestions from code review

Co-authored-by: Jason Stirnaman <stirnamanj@gmail.com>

* updates to address PR feedback

* update group by time example descriptions

* Apply suggestions from code review

Co-authored-by: Jason Stirnaman <stirnamanj@gmail.com>

---------

Co-authored-by: Jason Stirnaman <stirnamanj@gmail.com>

* Dedicated InfluxQL SELECT statement, quotation, and regexp docs (#4945)

* WIP influxql select and regexp

* update select examples, add quoting doc

* updated influxql regexp content

* Apply suggestions from code review

Co-authored-by: Jason Stirnaman <stirnamanj@gmail.com>

---------

Co-authored-by: Jason Stirnaman <stirnamanj@gmail.com>

* InfluxQL WHERE clause, date-time related content (#4946)

* WIP dedicated influxql where clause

* add time, time zone, date-time functions

* Apply suggestions from code review

Co-authored-by: Jason Stirnaman <stirnamanj@gmail.com>

---------

Co-authored-by: Jason Stirnaman <stirnamanj@gmail.com>

* InfluxQL GROUP BY with new sample data (#4954)

* finish influxql group by revamp

* Apply suggestions from code review

Co-authored-by: Stuart Carnie <stuart.carnie@gmail.com>

* minor fixes

* Apply suggestions from code review

Co-authored-by: Jason Stirnaman <stirnamanj@gmail.com>

* Apply suggestions from code review

* updates to address PR feedback

---------

Co-authored-by: Stuart Carnie <stuart.carnie@gmail.com>
Co-authored-by: Jason Stirnaman <stirnamanj@gmail.com>

* InfluxQL ORDER BY, LIMIT, SLIMIT, OFFSET, and SOFFSET clauses (#4957)

* order by, limit, slimit, offset, soffset clauses

* updated limit/offset behavior

* updated influxql landing page

---------

Co-authored-by: Jason Stirnaman <stirnamanj@gmail.com>
Co-authored-by: Stuart Carnie <stuart.carnie@gmail.com>
pull/4960/head
Scott Anderson 2023-05-26 10:30:08 -06:00 committed by GitHub
parent 1f64b24893
commit 60da4591c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 19348 additions and 12 deletions

View File

@ -1,4 +1,4 @@
// Placeholder start date used in InfluxDB getting started docs
// Placeholder start date used in InfluxDB custom timestamps
const defaultStartDate = "2022-01-01"
// Return yyyy-mm-dd formatted string from a Date object
@ -83,10 +83,10 @@ function updateTimestamps(newStartDate) {
})
var updateBlockElWhitelist = [
'.get-started-timestamps pre',
'.get-started-timestamps li',
'.get-started-timestamps p',
'.get-started-timestamps table'
'.custom-timestamps pre',
'.custom-timestamps li',
'.custom-timestamps p',
'.custom-timestamps table'
]
$(updateBlockElWhitelist.join()).each(function() {
@ -105,7 +105,7 @@ function updateTimestamps(newStartDate) {
})
})
$('span.get-started-timestamps').each(function() {
$('span.custom-timestamps').each(function() {
var wrapper = $(this)[0]
times.forEach(function(x) {

View File

@ -40,6 +40,14 @@ blockquote {
}
}
// Normal paragraph citations
& > p span.cite {
vertical-align: super;
line-height: 0;
font-size: .7rem;
font-style: italic;
}
////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// MEDIA QUERIES ////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

View File

@ -75,6 +75,16 @@ pre {
@import "code-api-methods";
}
// Styles for calling out specific code in code blocks
span.code-callout {
font-weight:bold;
margin:0 .15rem;
&.green {color: $article-code-accent3;}
&.magenta {color: $br-new-magenta;}
&.orange {color: $r-curacao;}
}
////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// MEDIA QUERIES ////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

View File

@ -4,6 +4,10 @@
margin: 2rem 0 2rem;
}
h5, h6 {
&+ .expand-wrapper { margin-top: .75rem;}
}
.expand {
border-top: 1px solid $article-hr;
padding: .75rem 0;

View File

@ -327,6 +327,103 @@ table tr.point{
&.hide-whitespace {p span.whitespace { border: none; &:before, &:after {display: none}}}
}
/////////////////////////// InfluxQL window diagram ////////////////////////////
#influxql-window-diagram {
min-width: 520px;
overflow: scroll;
display: flex;
flex-direction: row;
#timerange-label {
position: relative;
width: .7rem;
margin: 10.5rem .5rem 6.5rem .5rem;
border-width: 1px 0 1px 1px;
border-style: solid;
border-color: rgba($article-text, .3);
&::before {
content: "Queried time range";
display: block;
position: absolute;
background: $article-bg;
padding: 0 .75rem;
font-weight: $medium;
font-size: .9rem;
color: rgba($article-text, .5);
transform: rotate(-90deg);
white-space: nowrap;
top: 13.5rem;
left: -4.7rem;
}
}
td {
font-weight: medium;
color: $article-bold;
span.exclude {
opacity: .35;
font-weight: normal;
}
}
.windows {
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 4rem 0 2.5rem .25rem;
}
.window-hour {
justify-content: space-between;
height: 100%;
margin-bottom: .5rem;
border-left: 1px solid rgba($article-text, .3);
flex: 1 1 0;
position: relative;
&::before, &::after {
content: "";
position: absolute;
display: block;
width: 9px;
height: 1px;
left: -10px;
border-top: 1px solid rgba($article-text, .3);
}
&::before {top: 0}
&::after {bottom: -1px}
p {
white-space: nowrap;
margin-top: .55rem;
position: relative;
&::before {
content: "";
display: inline-block;
margin-right: .5rem;
width: 1rem;
height: 0;
border-top: 1px solid rgba($article-text, .3);
vertical-align: middle;
}
&::after {
content: "Predefined window boundary";
display: block;
position: absolute;
top: 1.25rem;
left: 1.5rem;
font-size: .9rem;
font-weight: $medium;
color: rgba($article-text, .5);
}
}
}
}
////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// MEDIA QUERIES ////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
@ -356,4 +453,28 @@ table tr.point{
.series-diagram {
width: auto;
}
#influxql-window-diagram {
justify-content: flex-start;
min-width: 300px;
.window-hour{
width: 60px;
p {
transform: rotate(-90deg);
position: relative;
margin-top: 8.75rem;
font-size: .95rem;
&::before {
transform: rotate(90deg);
position: absolute;
top: -.5rem;
left: 4.5rem;
}
&::after {
left: 0;
}
}
}
}
};

View File

@ -1032,6 +1032,11 @@ The sender continues to send the next packets.
This means computers can communicate more quickly.
This protocol is used when speed is desirable and error correction is not necessary.
### unix epoch
The date and time from which Unix system times are measured.
The Unix epoch is `1970-01-01T00:00:00Z`.
### unix timestamp
Counts time since **Unix Epoch (1970-01-01T00:00:00Z UTC)** in specified units ([precision](#precision)).

View File

@ -0,0 +1,765 @@
---
title: InfluxQL reference
list_title: InfluxQL
description: InfluxQL is an SQL-like query language for interacting with data in InfluxDB.
menu:
influxdb_cloud_dedicated:
parent: Reference
name: InfluxQL reference
identifier: influxql-reference
weight: 102
---
InfluxQL (Influx Query Language) is a SQL-like query language used to interact
with InfluxDB and work with times series data.
{{% warn %}}
#### InfluxQL feature support
InfluxQL is being rearchitected to work with the InfluxDB IOx storage engine.
This process is ongoing and some InfluxQL features are still being implemented.
For information about the current implementation status of InfluxQL features,
see [InfluxQL feature support](/influxdb/cloud-dedicated/reference/influxql/feature-support/).
{{% /warn %}}
- [Notation](#notation)
- [Query representation](#query-representation)
- [Characters](#characters)
- [Letters and digits](#letters-and-digits)
- [Identifiers](#identifiers)
- [Keywords](#keywords)
- [Literals](#literals)
- [Queries](#queries)
- [Statements](#statements)
- [Clauses](#clauses)
- [Expressions](#expressions)
- [Comments](#comments)
- [Other](#other)
<!-- To learn more about InfluxQL, browse the following topics:
- [Explore your data with InfluxQL](/influxdb/v2.7/query-data/influxql/explore-data/)
- [Explore your schema with InfluxQL](/influxdb/v2.7/query-data/influxql/explore-schema/)
- [Database management](/influxdb/v2.7/query-data/influxql/manage-database/)
- [Query engine internals](/influxdb/cloud-dedicated/reference/influxql/internals/) -->
## Notation
The syntax is specified using Extended Backus-Naur Form ("EBNF").
EBNF is the same notation used in the [Go programming language specification](https://golang.org/ref/spec).
```go
Production = production_name "=" [ Expression ] "." .
Expression = Alternative { "|" Alternative } .
Alternative = Term { Term } .
Term = production_name | token [ "…" token ] | Group | Option | Repetition .
Group = "(" Expression ")" .
Option = "[" Expression "]" .
Repetition = "{" Expression "}" .
```
Notation operators in order of increasing precedence:
```
| alternation
() grouping
[] option (0 or 1 times)
{} repetition (0 to n times)
```
## Query representation
### Characters
InfluxQL is Unicode text encoded in [UTF-8](http://en.wikipedia.org/wiki/UTF-8).
```
newline = /* the Unicode code point U+000A */ .
unicode_char = /* an arbitrary Unicode code point except newline */ .
```
### Letters and digits
Letters are the set of ASCII letters and the underscore (`_`, U+005F).
Only decimal digits are supported.
```
letter = ascii_letter | "_" .
ascii_letter = "A" … "Z" | "a" … "z" .
digit = "0" … "9" .
```
### Identifiers
Identifiers are tokens that refer to
[database](/influxdb/cloud-dedicated/reference/glossary/#database) names,
[retention policy](/influxdb/cloud-dedicated/reference/glossary/#retention-policy-rp) names,
[measurement](/influxdb/cloud-dedicated/reference/glossary/#measurement) names,
[tag keys](/influxdb/cloud-dedicated/reference/glossary/#tag-key), and
[field keys](/influxdb/cloud-dedicated/reference/glossary/#field-key).
The rules are as follows:
- Double-quoted identifiers can contain any Unicode character except for a new line.
- Double-quoted identifiers can also contain escaped `"` characters (i.e. `\"`).
- Double-quoted identifiers can include InfluxQL [keywords](#keywords).
- Unquoted identifiers must start with an upper or lowercase ASCII character or "_".
- Unquoted identifiers may contain only ASCII letters, decimal digits, and "_".
```
identifier = unquoted_identifier | quoted_identifier .
unquoted_identifier = ( letter ) { letter | digit } .
quoted_identifier = `"` unicode_char { unicode_char } `"` .
```
#### Examples
```
cpu
_cpu_stats
"1h"
"anything really"
"1_Crazy-1337.identifier>NAME👍"
```
### Keywords
```
ALL ALTER ANY AS ASC BEGIN
BY CREATE CONTINUOUS DATABASE DATABASES DEFAULT
DELETE DESC DESTINATIONS DIAGNOSTICS DISTINCT DROP
DURATION END EVERY EXPLAIN FIELD FOR
FROM GRANT GRANTS GROUP GROUPS IN
INF INSERT INTO KEY KEYS KILL
LIMIT SHOW MEASUREMENT MEASUREMENTS NAME OFFSET
ON ORDER PASSWORD POLICY POLICIES PRIVILEGES
QUERIES QUERY READ REPLICATION RESAMPLE RETENTION
REVOKE SELECT SERIES SET SHARD SHARDS
SLIMIT SOFFSET STATS SUBSCRIPTION SUBSCRIPTIONS TAG
TO USER USERS VALUES WHERE WITH
WRITE
```
If you use an InfluxQL keyword as an
[identifier](/influxdb/cloud-dedicated/reference/glossary/#identifier),
double-quote the identifier in every query.
The `time` keyword is a special case.
`time` can be a
database name,
[measurement](/influxdb/cloud-dedicated/reference/glossary/#measurement) name,
[retention policy](/influxdb/cloud-dedicated/reference/glossary/#retention-policy-rp) name, and
[user](/influxdb/cloud-dedicated/reference/glossary/#user) name.
In those cases, you don't need to double-quote `time` in queries.
`time` can't be a [field key](/influxdb/cloud-dedicated/reference/glossary/#field-key) or
[tag key](/influxdb/cloud-dedicated/reference/glossary/#tag-key);
InfluxDB rejects writes with `time` as a field key or tag key and returns an error.
See [Frequently Asked Questions](/influxdb/v2.7/reference/faq/) for more information.
### Literals
#### Integers
InfluxQL supports decimal integer literals.
Hexadecimal and octal literals aren't currently supported.
```
int_lit = ( "1" … "9" ) { digit } .
```
#### Floats
InfluxQL supports floating-point literals.
Exponents aren't currently supported.
```
float_lit = int_lit "." int_lit .
```
#### Strings
String literals must be surrounded by single quotes.
Strings may contain `'` characters as long as they are escaped (i.e., `\'`).
```
string_lit = `'` { unicode_char } `'` .
```
#### Durations
Duration literals specify a length of time.
An integer literal followed immediately (with no spaces) by one of the duration units listed below is interpreted as a duration literal.
Durations can be specified with mixed units.
##### Duration units
| Units | Meaning |
| ------ | --------------------------------------- |
| ns | nanoseconds (1 billionth of a second) |
| u or µ | microseconds (1 millionth of a second) |
| ms | milliseconds (1 thousandth of a second) |
| s | second |
| m | minute |
| h | hour |
| d | day |
| w | week |
```
duration_lit = int_lit duration_unit .
duration_unit = "ns" | "u" | "µ" | "ms" | "s" | "m" | "h" | "d" | "w" .
```
#### Dates & Times
Unlike other notations used in InfluxQL, the date and time literal format isn't specified by EBNF.
InfluxQL date and time is specified using Go's time parsing format and
[reference date](https://pkg.go.dev/time#pkg-constants) written in the format required by InfluxQL.
The reference date time is:
InfluxQL reference date time: January 2nd, 2006 at 3:04:05 PM
```
time_lit = "2006-01-02 15:04:05.999999" | "2006-01-02" .
```
#### Booleans
```
bool_lit = TRUE | FALSE .
```
#### Regular Expressions
```
regex_lit = "/" { unicode_char } "/" .
```
**Comparators:**
`=~` matches against
`!~` doesn't match against
{{% note %}}
InfluxQL supports using regular expressions when specifying:
- [field keys](/influxdb/cloud-dedicated/reference/glossary/#field-key) and [tag keys](/influxdb/cloud-dedicated/reference/glossary/#tag-key) in the [`SELECT` clause](/influxdb/cloud-dedicated/reference/influxql/select/)
- [measurements](/influxdb/cloud-dedicated/reference/glossary/#measurement) in the [`FROM` clause](/influxdb/cloud-dedicated/reference/influxql/select/#from-clause)
- [tag values](/influxdb/cloud-dedicated/reference/glossary/#tag-value) and
string [field values](/influxdb/cloud-dedicated/reference/glossary/#field-value)
in the [`WHERE` clause](/influxdb/cloud-dedicated/reference/influxql/where/)
- [tag keys](/influxdb/cloud-dedicated/reference/glossary/#tag-key) in the
[`GROUP BY` clause](/influxdb/cloud-dedicated/reference/influxql/group-by/)
Currently, InfluxQL doesn't support using regular expressions to match non-string
field values in the `WHERE` clause, [databases](/influxdb/cloud-dedicated/reference/glossary/#database),
and [retention polices](/influxdb/cloud-dedicated/reference/glossary/#retention-policy-rp).
{{% /note %}}
## Queries
A query is composed of one or more statements separated by a semicolon (`;`).
```
query = statement { ";" statement } .
statement = explain_stmt |
explain_analyze_stmt |
select_stmt |
show_databases_stmt |
show_field_key_cardinality_stmt |
show_field_keys_stmt |
show_measurement_exact_cardinality_stmt |
show_measurements_stmt |
show_series_exact_cardinality_stmt |
show_series_stmt |
show_tag_key_cardinality_stmt |
show_tag_key_exact_cardinality_stmt |
show_tag_keys_stmt |
show_tag_values_with_key = stmt |
show_tag_values_cardinality_stmt .
```
## Statements
### EXPLAIN
Parses and plans the query, and then prints a summary of estimated costs.
Many SQL engines use the `EXPLAIN` statement to show join order, join algorithms, and predicate and expression pushdown.
Since InfluxQL doesn't support joins, the cost of an InfluxQL query is typically a function of the total series accessed, the number of iterator accesses to a TSM file, and the number of TSM blocks that need to be scanned.
A query plan generated by `EXPLAIN` contains the following elements:
- expression
- auxillary fields
- number of shards
- number of series
- cached values
- number of files
- number of blocks
- size of blocks
```
explain_stmt = "EXPLAIN" select_stmt .
```
#### Example
```sql
> explain select sum(pointReq) from "_internal"."monitor"."write" group by hostname;
> QUERY PLAN
------
EXPRESSION: sum(pointReq::integer)
NUMBER OF SHARDS: 2
NUMBER OF SERIES: 2
CACHED VALUES: 110
NUMBER OF FILES: 1
NUMBER OF BLOCKS: 1
SIZE OF BLOCKS: 931
```
### EXPLAIN ANALYZE
Executes the specified `SELECT` statement and returns data about the query performance and storage during runtime, visualized as a tree. Use this statement to analyze query performance and storage, including [execution time](#execution-time) and [planning time](#planning-time), and the [iterator type](#iterator-type) and [cursor type](#cursor-type).
For example, if you execute the following statement:
```sql
> explain analyze select mean(usage_steal) from cpu where time >= '2018-02-22T00:00:00Z' and time < '2018-02-22T12:00:00Z'
```
The output is similar to the following:
```sql
EXPLAIN ANALYZE
---------------
.
└── select
├── execution_time: 2.25823ms
├── planning_time: 18.381616ms
├── total_time: 20.639846ms
└── field_iterators
├── labels
│ └── statement: SELECT mean(usage_steal::float) FROM telegraf."default".cpu
└── expression
├── labels
│ └── expr: mean(usage_steal::float)
└── create_iterator
├── labels
│ ├── measurement: cpu
│ └── shard_id: 608
├── cursors_ref: 779
├── cursors_aux: 0
├── cursors_cond: 0
├── float_blocks_decoded: 431
├── float_blocks_size_bytes: 1003552
├── integer_blocks_decoded: 0
├── integer_blocks_size_bytes: 0
├── unsigned_blocks_decoded: 0
├── unsigned_blocks_size_bytes: 0
├── string_blocks_decoded: 0
├── string_blocks_size_bytes: 0
├── boolean_blocks_decoded: 0
├── boolean_blocks_size_bytes: 0
└── planning_time: 14.805277ms```
```
{{% note %}}
`EXPLAIN ANALYZE` ignores query output, so the cost of serialization to JSON or
CSV isn't accounted for.
{{% /note %}}
##### execution_time
Shows the amount of time the query took to execute, including reading the time series data, performing operations as data flows through iterators, and draining processed data from iterators. Execution time doesn't include the time taken to serialize the output into JSON or other formats.
##### planning_time
Shows the amount of time the query took to plan.
Planning a query in InfluxDB requires a number of steps. Depending on the complexity of the query, planning can require more work and consume more CPU and memory resources than executing the query. For example, the number of series keys required to execute a query affects how quickly the query is planned and how much memory the planning requires.
First, InfluxDB determines the effective time range of the query and selects the shards to access.
Next, for each shard and each measurement, InfluxDB performs the following steps:
1. Select matching series keys from the index, filtered by tag predicates in the `WHERE` clause.
2. Group filtered series keys into tag sets based on the `GROUP BY` dimensions.
3. Enumerate each tag set and create a cursor and iterator for each series key.
4. Merge iterators and return the merged result to the query executor.
##### iterator type
`EXPLAIN ANALYZE` supports the following iterator types:
- `create_iterator` node represents work done by the local influxd instance──a complex composition of nested iterators combined and merged to produce the final query output.
- (InfluxDB Enterprise only) `remote_iterator` node represents work done on remote machines.
For more information about iterators, see [Understanding iterators](#understanding-iterators).
##### cursor type
`EXPLAIN ANALYZE` distinguishes 3 cursor types. While the cursor types have the same data structures and equal CPU and I/O costs, each cursor type is constructed for a different reason and separated in the final output. Consider the following cursor types when tuning a statement:
- cursor_ref: Reference cursor created for `SELECT` projections that include a function, such as `last()` or `mean()`.
- cursor_aux: Auxiliary cursor created for simple expression projections (not selectors or an aggregation). For example, `SELECT foo FROM m` or `SELECT foo+bar FROM m`, where `foo` and `bar` are fields.
- cursor_cond: Condition cursor created for fields referenced in a `WHERE` clause.
For more information about cursors, see [Understanding cursors](#understanding-cursors).
##### block types
`EXPLAIN ANALYZE` separates storage block types, and reports the total number of
blocks decoded and their size (in bytes) on disk. The following block types are supported:
| Type | Description |
| :--------- | :------------------------------------ |
| `float` | 64-bit IEEE-754 floating-point number |
| `integer` | 64-bit signed integer |
| `unsigned` | 64-bit unsigned integer |
| `boolean` | 1-bit, LSB encoded |
| `string` | UTF-8 string |
### SELECT
```
select_stmt = "SELECT" fields from_clause [ where_clause ]
[ group_by_clause ] [ order_by_clause ] [ limit_clause ]
[ offset_clause ] [ slimit_clause ] [ soffset_clause ] [ timezone_clause ] .
```
#### Example
Select from measurements grouped by the day with a timezone
```sql
SELECT mean("value") FROM "cpu" GROUP BY region, time(1d) fill(0) tz('America/Chicago')
```
### SHOW CARDINALITY
Refers to the group of commands used to estimate or count exactly the cardinality of measurements, series, tag keys, tag key values, and field keys.
The SHOW CARDINALITY commands are available in two variations: _estimated_ and _exact_. Estimated values are calculated using sketches and are a safe default for all cardinality sizes. Exact values are counts directly from TSM (Time-Structured Merge Tree) data, but are expensive to run for high cardinality data. Unless required, use the estimated variety.
Filtering by `time` is only supported when Time Series Index (TSI) is enabled on a database.
See the specific SHOW CARDINALITY commands for details:
- [SHOW FIELD KEY CARDINALITY](#show-field-key-cardinality)
- [SHOW SERIES CARDINALITY](#show-series-cardinality)
- [SHOW TAG KEY CARDINALITY](#show-tag-key-cardinality)
- [SHOW TAG VALUES CARDINALITY](#show-tag-values-cardinality)
### SHOW DATABASES
```
show_databases_stmt = "SHOW DATABASES" .
```
#### Example
```sql
-- show all databases
SHOW DATABASES
```
### SHOW FIELD KEY CARDINALITY
Estimates or counts exactly the cardinality of the field key set for the curren
database unless a database is specified using the `ON <database>` option.
{{% note %}}
**Note:** `ON <database>`, `FROM <sources>`, `WITH KEY = <key>`,
`WHERE <condition>`, `GROUP BY <dimensions>`, and `LIMIT/OFFSET` clauses are optional.
When using these query clauses, the query falls back to an exact count.
{{% /note %}}
```sql
show_field_key_cardinality_stmt = "SHOW FIELD KEY CARDINALITY" [ on_clause ] [ from_clause ] [ where_clause ] [ group_by_clause ] [ limit_clause ] [ offset_clause ]
show_field_key_exact_cardinality_stmt = "SHOW FIELD KEY EXACT CARDINALITY" [ on_clause ] [ from_clause ] [ where_clause ] [ group_by_clause ] [ limit_clause ] [ offset_clause ]
```
#### Examples
```sql
-- show estimated cardinality of the field key set of current database
SHOW FIELD KEY CARDINALITY
-- show exact cardinality on field key set of specified database
SHOW FIELD KEY EXACT CARDINALITY ON mydb
```
### SHOW FIELD KEYS
```
show_field_keys_stmt = "SHOW FIELD KEYS" [on_clause] [ from_clause ] .
```
#### Examples
```sql
-- show field keys and field value data types from all measurements
SHOW FIELD KEYS
-- show field keys and field value data types from specified measurement
SHOW FIELD KEYS FROM "cpu"
```
### SHOW MEASUREMENTS
```
show_measurements_stmt = "SHOW MEASUREMENTS" [on_clause] [ with_measurement_clause ] [ where_clause ] [ limit_clause ] [ offset_clause ] .
```
#### Examples
```sql
-- show all measurements
SHOW MEASUREMENTS
-- show measurements where region tag = 'uswest' AND host tag = 'serverA'
SHOW MEASUREMENTS WHERE "region" = 'uswest' AND "host" = 'serverA'
-- show measurements that start with 'h2o'
SHOW MEASUREMENTS WITH MEASUREMENT =~ /h2o.*/
```
### SHOW SERIES
```
show_series_stmt = "SHOW SERIES" [on_clause] [ from_clause ] [ where_clause ] [ limit_clause ] [ offset_clause ] .
```
#### Example
```sql
SHOW SERIES FROM "telegraf"."autogen"."cpu" WHERE cpu = 'cpu8'
```
### SHOW SERIES EXACT CARDINALITY
Estimates or counts exactly the cardinality of the series for the current
database unless a database is specified using the `ON database` option.
#### Example
SHOW SERIES EXACT CARDINALITY" [ on_clause ] [ from_clause ]
[ where_clause ] [ group_by_clause ] [ limit_clause ] [ offset_clause ]
```sql
SHOW SERIES EXACT CARDINALITY ON mydb
```
{{% note %}}
**NOTE:** `ON <database>`, `FROM <sources>`, `WITH KEY = <key>`,
`WHERE <condition>`, `GROUP BY <dimensions>`, and `LIMIT/OFFSET` clauses are optional.
When using these query clauses, the query falls back to an exact count.
Filtering by `time` is not supported in the `WHERE` clause.
{{% /note %}}
### SHOW TAG KEY CARDINALITY
Estimates or counts exactly the cardinality of tag key set on the current
database unless a database is specified using the `ON <database>` option.
{{% note %}}
`ON <database>`, `FROM <sources>`, `WITH KEY = <key>`, `WHERE <condition>`,
`GROUP BY <dimensions>`, and `LIMIT/OFFSET` clauses are optional.
When using these query clauses, the query falls back to an exact count.
Filtering by `time` is only supported when TSI (Time Series Index) is enabled
and `time` is not supported in the `WHERE` clause.
{{% /note %}}
```
show_tag_key_cardinality_stmt = "SHOW TAG KEY CARDINALITY" [ on_clause ] [ from_clause ] [ where_clause ] [ group_by_clause ] [ limit_clause ] [ offset_clause ]
show_tag_key_exact_cardinality_stmt = "SHOW TAG KEY EXACT CARDINALITY" [ on_clause ] [ from_clause ] [ where_clause ] [ group_by_clause ] [ limit_clause ] [ offset_clause ]
```
#### Examples
```sql
-- show estimated tag key cardinality
SHOW TAG KEY CARDINALITY
-- show exact tag key cardinality
SHOW TAG KEY EXACT CARDINALITY
```
### SHOW TAG KEYS
```
show_tag_keys_stmt = "SHOW TAG KEYS" [on_clause] [ from_clause ] [ where_clause ]
[ limit_clause ] [ offset_clause ] .
```
#### Examples
```sql
-- show all tag keys
SHOW TAG KEYS
-- show all tag keys from the cpu measurement
SHOW TAG KEYS FROM "cpu"
-- show all tag keys from the cpu measurement where the region key = 'uswest'
SHOW TAG KEYS FROM "cpu" WHERE "region" = 'uswest'
-- show all tag keys where the host key = 'serverA'
SHOW TAG KEYS WHERE "host" = 'serverA'
```
### SHOW TAG VALUES
```
show_tag_values_stmt = "SHOW TAG VALUES" [on_clause] [ from_clause ] with_tag_clause [ where_clause ]
[ limit_clause ] [ offset_clause ] .
```
#### Examples
```sql
-- show all tag values across all measurements for the region tag
SHOW TAG VALUES WITH KEY = "region"
-- show tag values from the cpu measurement for the region tag
SHOW TAG VALUES FROM "cpu" WITH KEY = "region"
-- show tag values across all measurements for all tag keys that do not include the letter c
SHOW TAG VALUES WITH KEY !~ /.*c.*/
-- show tag values from the cpu measurement for region & host tag keys where service = 'redis'
SHOW TAG VALUES FROM "cpu" WITH KEY IN ("region", "host") WHERE "service" = 'redis'
```
### SHOW TAG VALUES CARDINALITY
Estimates or counts exactly the cardinality of tag key values for the specified
tag key on the current database unless a database is specified using the
`ON database` option.
{{% note %}}
**Note:** `ON <database>`, `FROM <sources>`, `WITH KEY = <key>`,
`WHERE <condition>`, `GROUP BY <dimensions>`, and `LIMIT/OFFSET` clauses are optional.
When using these query clauses, the query falls back to an exact count.
Filtering by `time` is only supported when TSI (Time Series Index) is enabled.
{{% /note %}}
```
show_tag_values_cardinality_stmt = "SHOW TAG VALUES CARDINALITY" [ on_clause ] [ from_clause ] [ where_clause ] [ group_by_clause ] [ limit_clause ] [ offset_clause ] with_key_clause
show_tag_values_exact_cardinality_stmt = "SHOW TAG VALUES EXACT CARDINALITY" [ on_clause ] [ from_clause ] [ where_clause ] [ group_by_clause ] [ limit_clause ] [ offset_clause ] with_key_clause
```
#### Examples
```sql
-- show estimated tag key values cardinality for a specified tag key
SHOW TAG VALUES CARDINALITY WITH KEY = "myTagKey"
-- show estimated tag key values cardinality for a specified tag key
SHOW TAG VALUES CARDINALITY WITH KEY = "myTagKey"
-- show exact tag key values cardinality for a specified tag key
SHOW TAG VALUES EXACT CARDINALITY WITH KEY = "myTagKey"
-- show exact tag key values cardinality for a specified tag key
SHOW TAG VALUES EXACT CARDINALITY WITH KEY = "myTagKey"
```
## Clauses
```
from_clause = "FROM" measurements .
group_by_clause = "GROUP BY" dimensions fill(fill_option).
limit_clause = "LIMIT" int_lit .
offset_clause = "OFFSET" int_lit .
slimit_clause = "SLIMIT" int_lit .
soffset_clause = "SOFFSET" int_lit .
timezone_clause = tz(string_lit) .
on_clause = "ON" db_name .
order_by_clause = "ORDER BY" sort_fields .
where_clause = "WHERE" expr .
with_measurement_clause = "WITH MEASUREMENT" ( "=" measurement | "=~" regex_lit ) .
with_tag_clause = "WITH KEY" ( "=" tag_key | "!=" tag_key | "=~" regex_lit | "IN (" tag_keys ")" ) .
```
## Expressions
```
binary_op = "+" | "-" | "*" | "/" | "%" | "&" | "|" | "^" | "AND" |
"OR" | "=" | "!=" | "<>" | "<" | "<=" | ">" | ">=" .
expr = unary_expr { binary_op unary_expr } .
unary_expr = "(" expr ")" | var_ref | time_lit | string_lit | int_lit |
float_lit | bool_lit | duration_lit | regex_lit .
```
## Comments
Use comments with InfluxQL statements to describe your queries.
- A single line comment begins with two hyphens (`--`) and ends where InfluxDB detects a line break.
This comment type cannot span several lines.
- A multi-line comment begins with `/*` and ends with `*/`. This comment type can span several lines.
Multi-line comments do not support nested multi-line comments.
## Other
```
alias = "AS" identifier .
back_ref = ( policy_name ".:MEASUREMENT" ) |
( db_name "." [ policy_name ] ".:MEASUREMENT" ) .
db_name = identifier .
dimension = expr .
dimensions = dimension { "," dimension } .
field_key = identifier .
field = expr [ alias ] .
fields = field { "," field } .
fill_option = "null" | "none" | "previous" | int_lit | float_lit | "linear" .
host = string_lit .
measurement = measurement_name |
( policy_name "." measurement_name ) |
( db_name "." [ policy_name ] "." measurement_name ) .
measurements = measurement { "," measurement } .
measurement_name = identifier | regex_lit .
policy_name = identifier .
retention_policy = identifier .
retention_policy_name = "NAME" identifier .
series_id = int_lit .
sort_field = field_key [ ASC | DESC ] .
sort_fields = sort_field { "," sort_field } .
tag_key = identifier .
tag_keys = tag_key { "," tag_key } .
var_ref = measurement .
```

View File

@ -0,0 +1,167 @@
---
title: InfluxQL feature support
description: >
InfluxQL is being rearchitected to work with the InfluxDB IOx storage engine.
This process is ongoing and some InfluxQL features are still being implemented.
This page provides information about the current implementation status of
InfluxQL features.
menu:
influxdb_cloud_dedicated:
parent: influxql-reference
weight: 220
---
InfluxQL is being rearchitected to work with the InfluxDB IOx storage engine.
This process is ongoing and some InfluxQL features are still being implemented.
This page provides information about the current implementation status of
InfluxQL features.
- [In-progress features](#in-progress-features)
- [Time zones](#time-zones)
- [Subqueries](#subqueries)
- [SLIMIT clause](#slimit-clause)
- [SOFFSET clause](#soffset-clause)
- [Project additional fields with selector functions](#project-additional-fields-with-selector-functions)
- [Function support](#function-support)
- [Aggregate functions](#aggregate-functions)
- [Selector functions](#selector-functions)
- [Transformations](#transformations)
- [Technical and predictive analysis](#technical-and-predictive-analysis)
## In-progress features
### Time zones
InfluxQL in {{< cloud-name >}} does not currently support the time zone clause,
which applies a time zone offset to UTC timestamps in query results.
**Tracking issue**: [influxdb_iox#6933](https://github.com/influxdata/influxdb_iox/issues/6933)
### Subqueries
InfluxQL in {{< cloud-name >}} does not currently support subqueries, which
let you query data from the results of another InfluxQL query.
**Tracking issue**: [influxdb_iox#6897](https://github.com/influxdata/influxdb_iox/issues/6897)
### SLIMIT clause
InfluxQL in {{< cloud-name >}} does not currently support the `SLIMIT` clause,
which limits the number of [series](/influxdb/cloud-dedicated/reference/glossary/#series)
returned in query results.
**Tracking issue**: [influxdb_iox#6940](https://github.com/influxdata/influxdb_iox/issues/6940)
### SOFFSET clause
InfluxQL in {{< cloud-name >}} does not currently support the `SOFFSET` clause,
which specifies the number of [series](/influxdb/cloud-dedicated/reference/glossary/#series)
to skip before returning results.
**Tracking issue**: [influxdb_iox#6940](https://github.com/influxdata/influxdb_iox/issues/6940)
### Project additional fields with selector functions
InfluxQL in {{< cloud-name >}} does not currently let you project additional
fields when using [selector functions](/influxdb/cloud-dedicated/reference/influxql/functions/selectors/).
Selector functions return specific rows with values that meets the criteria
of the function. Projecting other fields returns additional field values associated
with the selected row and timestamp. For example:
```sql
SELECT MAX(co), temp, hum FROM home
```
This query selects the row with the maximum `co` value and should return the
`temp` and `hum` value currently associated with that row.
This query currently returns an error.
**Tracking issue**: [influxdb_iox#7533](https://github.com/influxdata/influxdb_iox/issues/7533)
## Function support
### Aggregate functions
| Function | Supported | Tracking Issue |
| :------------------------------------------- | :----------------------: | :-------------------------------------------------------------------------- |
| [COUNT()](functions/aggregates/#count) | **{{< icon "check" >}}** | |
| [DISTINCT()](functions/aggregates/#distinct) | **{{< icon "check" >}}** | |
| <span style="opacity: .5;">INTEGRAL()</span> | | [influxdb_iox#6937](https://github.com/influxdata/influxdb_iox/issues/6937) |
| [MEAN()](functions/aggregates/#mean) | **{{< icon "check" >}}** | |
| [MEDIAN()](functions/aggregates/#median) | **{{< icon "check" >}}** | |
| <span style="opacity: .5;">MODE()</span> | | [influxdb_iox#7334](https://github.com/influxdata/influxdb_iox/issues/7334) |
| <span style="opacity: .5;">SPREAD()</span> | | [influxdb_iox#6937](https://github.com/influxdata/influxdb_iox/issues/6937) |
| [STDDEV()](functions/aggregates/#stddev) | **{{< icon "check" >}}** | |
| [SUM()](functions/aggregates/#sum) | **{{< icon "check" >}}** | |
### Selector functions
| Function | Supported | Tracking Issue |
| :--------------------------------------------- | :----------------------: | :-------------------------------------------------------------------------- |
| <span style="opacity: .5;">BOTTOM()</span> | | [influxdb_iox#6935](https://github.com/influxdata/influxdb_iox/issues/6935) |
| [FIRST()](functions/selectors/#first) | **{{< icon "check" >}}** | |
| [LAST()](functions/selectors/#last) | **{{< icon "check" >}}** | |
| [MAX()](functions/selectors/#max) | **{{< icon "check" >}}** | |
| [MIN()](functions/selectors/#min) | **{{< icon "check" >}}** | |
| <span style="opacity: .5;">PERCENTILE()</span> | | [influxdb_iox#7664](https://github.com/influxdata/influxdb_iox/issues/7664) |
| <span style="opacity: .5;">SAMPLE()</span> | | [influxdb_iox#6935](https://github.com/influxdata/influxdb_iox/issues/6935) |
| <span style="opacity: .5;">TOP()</span> | | [influxdb_iox#7650](https://github.com/influxdata/influxdb_iox/issues/7650) |
### Transformations
| Function | Supported | Tracking Issue |
| :--------------------------------------------------------- | :----------------------: | :-------------------------------------------------------------------------- |
| [ABS()](functions/transformations/#abs) | **{{< icon "check" >}}** | |
| [ACOS()](functions/transformations/#acos) | **{{< icon "check" >}}** | |
| [ASIN()](functions/transformations/#asin) | **{{< icon "check" >}}** | |
| [ATAN()](functions/transformations/#atan) | **{{< icon "check" >}}** | |
| [ATAN2()](functions/transformations/#atan2) | **{{< icon "check" >}}** | |
| [CEIL()](functions/transformations/#ceil) | **{{< icon "check" >}}** | |
| [COS()](functions/transformations/#cos) | **{{< icon "check" >}}** | |
| <span style="opacity: .5;">CUMULATIVE_SUM()<span> | | [influxdb_iox#7467](https://github.com/influxdata/influxdb_iox/issues/7467) |
| <span style="opacity: .5;">DERIVATIVE()<span> | | [influxdb_iox#7647](https://github.com/influxdata/influxdb_iox/issues/7647) |
| <span style="opacity: .5;">DIFFERENCE()<span> | | [influxdb_iox#7468](https://github.com/influxdata/influxdb_iox/issues/7468) |
| <span style="opacity: .5;">ELAPSED()<span> | | [influxdb_iox#6934](https://github.com/influxdata/influxdb_iox/issues/6934) |
| [EXP()](functions/transformations/#exp) | **{{< icon "check" >}}** | |
| [FLOOR()](functions/transformations/#floor) | **{{< icon "check" >}}** | |
| [LN()](functions/transformations/#ln) | **{{< icon "check" >}}** | |
| [LOG()](functions/transformations/#log) | **{{< icon "check" >}}** | |
| [LOG2()](functions/transformations/#log2) | **{{< icon "check" >}}** | |
| [LOG10()](functions/transformations/#log10) | **{{< icon "check" >}}** | |
| <span style="opacity: .5;">MOVING_AVERAGE()<span> | | [influxdb_iox#7600](https://github.com/influxdata/influxdb_iox/issues/7600) |
| <span style="opacity: .5;">NON_NEGATIVE_DERIVATIVE()<span> | | [influxdb_iox#7649](https://github.com/influxdata/influxdb_iox/issues/7649) |
| <span style="opacity: .5;">NON_NEGATIVE_DIFFERENCE()<span> | | [influxdb_iox#7628](https://github.com/influxdata/influxdb_iox/issues/7628) |
| [POW()](functions/transformations/#pow) | **{{< icon "check" >}}** | |
| [ROUND()](functions/transformations/#round) | **{{< icon "check" >}}** | |
| [SIN()](functions/transformations/#sin) | **{{< icon "check" >}}** | |
| [SQRT()](functions/transformations/#sqrt) | **{{< icon "check" >}}** | |
| [TAN()](functions/transformations/#tan) | **{{< icon "check" >}}** | |
### Technical and predictive analysis
| Function | Supported | Tracking Issue |
| :-------------------------------------------------------------------- | :-------: | :-------------------------------------------------------------------------- |
| <span style="opacity: .5;">CHANDE_MOMENTUM_OSCILLATOR()</span> | | [influxdb_iox#6939](https://github.com/influxdata/influxdb_iox/issues/6939) |
| <span style="opacity: .5;">DOUBLE_EXPONENTIAL_MOVING_AVERAGE()</span> | | [influxdb_iox#6939](https://github.com/influxdata/influxdb_iox/issues/6939) |
| <span style="opacity: .5;">EXPONENTIAL_MOVING_AVERAGE()</span> | | [influxdb_iox#6939](https://github.com/influxdata/influxdb_iox/issues/6939) |
| <span style="opacity: .5;">HOLT_WINTERS()</span> | | [influxdb_iox#6939](https://github.com/influxdata/influxdb_iox/issues/6939) |
| <span style="opacity: .5;">HOLT_WINTERS_WITH_FIT()</span> | | [influxdb_iox#6939](https://github.com/influxdata/influxdb_iox/issues/6939) |
| <span style="opacity: .5;">KAUFMANS_EFFICIENCY_RATIO()</span> | | [influxdb_iox#6939](https://github.com/influxdata/influxdb_iox/issues/6939) |
| <span style="opacity: .5;">KAUFMANS_ADAPTIVE_MOVING_AVERAGE()</span> | | [influxdb_iox#6939](https://github.com/influxdata/influxdb_iox/issues/6939) |
| <span style="opacity: .5;">RELATIVE_STRENGTH_INDEX()</span> | | [influxdb_iox#6939](https://github.com/influxdata/influxdb_iox/issues/6939) |
| <span style="opacity: .5;">TRIPLE_EXPONENTIAL_MOVING_AVERAGE()</span> | | [influxdb_iox#6939](https://github.com/influxdata/influxdb_iox/issues/6939) |
| <span style="opacity: .5;">TRIPLE_EXPONENTIAL_DERIVATIVE()</span> | | [influxdb_iox#6939](https://github.com/influxdata/influxdb_iox/issues/6939) |
### Date and time functions
| Function | Supported | Tracking Issue |
| :------------------------------------------------------------------------------- | :----------------------: | :-------------------------------------------------------------------------- |
| [now()](/influxdb/cloud-dedicated/reference/influxql/functions/date-time/#now) | **{{< icon "check" >}}** | |
| [time()](/influxdb/cloud-dedicated/reference/influxql/functions/date-time/#time) | **{{< icon "check" >}}** | |
| <span style="opacity: .5;">tz()</span> | | [influxdb_iox#6933](https://github.com/influxdata/influxdb_iox/issues/6933) |
### Miscellaneous functions
| Function | Supported | Tracking Issue |
| :-------------------------------------------------------------------------- | :----------------------: | :------------- |
| [fill()](/influxdb/cloud-dedicated/reference/influxql/functions/misc/#fill) | **{{< icon "check" >}}** | |

View File

@ -0,0 +1,86 @@
---
title: View InfluxQL functions
description: >
Aggregate, select, transform, and predict data with InfluxQL functions.
menu:
influxdb_cloud_dedicated:
name: InfluxQL functions
parent: influxql-reference
identifier: influxql-functions
weight: 208
---
Use InfluxQL functions to aggregate, select, transform, analyze, and predict data.
{{% note %}}
#### Missing InfluxQL functions
Some InfluxQL functions are in the process of being rearchitected to work with
the InfluxDB IOx storage engine. If a function you need is not here, check the
[InfluxQL feature support page](/influxdb/cloud-dedicated/reference/influxql/feature-support/#function-support)
for more information.
{{% /note %}}
## InfluxQL functions (by type)
- [Aggregates](/influxdb/cloud-dedicated/reference/influxql/functions/aggregates/)
- [COUNT()](/influxdb/cloud-dedicated/reference/influxql/functions/aggregates/#count)
- [DISTINCT()](/influxdb/cloud-dedicated/reference/influxql/functions/aggregates/#distinct)
- [MEAN()](/influxdb/cloud-dedicated/reference/influxql/functions/aggregates/#mean)
- [MEDIAN()](/influxdb/cloud-dedicated/reference/influxql/functions/aggregates/#median)
- [STDDEV()](/influxdb/cloud-dedicated/reference/influxql/functions/aggregates/#stddev)
- [SUM()](/influxdb/cloud-dedicated/reference/influxql/functions/aggregates/#sum)
<!-- - [INTEGRAL()](/influxdb/cloud-dedicated/reference/influxql/functions/aggregates/#integral) -->
<!-- - [MODE()](/influxdb/cloud-dedicated/reference/influxql/functions/aggregates/#mode) -->
<!-- - [SPREAD()](/influxdb/cloud-dedicated/reference/influxql/functions/aggregates/#spread) -->
- [Selectors](/influxdb/cloud-dedicated/reference/influxql/functions/selectors/)
- [FIRST()](/influxdb/cloud-dedicated/reference/influxql/functions/selectors/#first)
- [LAST()](/influxdb/cloud-dedicated/reference/influxql/functions/selectors/#last)
- [MAX()](/influxdb/cloud-dedicated/reference/influxql/functions/selectors/#max)
- [MIN()](/influxdb/cloud-dedicated/reference/influxql/functions/selectors/#min)
<!-- - [BOTTOM()](/influxdb/cloud-dedicated/reference/influxql/functions/selectors/#bottom) -->
<!-- - [PERCENTILE()](/influxdb/cloud-dedicated/reference/influxql/functions/selectors/#percentile) -->
<!-- - [SAMPLE()](/influxdb/cloud-dedicated/reference/influxql/functions/selectors/#sample) -->
<!-- - [TOP()](/influxdb/cloud-dedicated/reference/influxql/functions/selectors/#top) -->
- [Transformations](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/)
- [ABS()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#abs)
- [ACOS()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#acos)
- [ASIN()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#asin)
- [ATAN()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#atan)
- [ATAN2()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#atan2)
- [CEIL()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#ceil)
- [COS()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#cos)
- [EXP()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#exp)
- [FLOOR()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#floor)
- [HISTOGRAM()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#histogram)
- [LN()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#ln)
- [LOG()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#log)
- [LOG2()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#log2)
- [LOG10()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#log10)
- [POW()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#pow)
- [ROUND()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#round)
- [SIN()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#sin)
- [SQRT()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#sqrt)
- [TAN()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#tan)
<!-- - [CUMULATIVE_SUM()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#cumulative_sum) -->
<!-- - [DERIVATIVE()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#derivative) -->
<!-- - [DIFFERENCE()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#difference) -->
<!-- - [ELAPSED()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#elapsed) -->
<!-- - [MOVING_AVERAGE()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#moving_average) -->
<!-- - [NON_NEGATIVE_DERIVATIVE()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#non_negative_derivative) -->
<!-- - [NON_NEGATIVE_DIFFERENCE()](/influxdb/cloud-dedicated/reference/influxql/functions/transformations/#non_negative_difference) -->
- [Date and time](/influxdb/cloud-dedicated/reference/influxql/functions/date-time/)
- [now()](/influxdb/cloud-dedicated/reference/influxql/functions/date-time/#now)
- [time()](/influxdb/cloud-dedicated/reference/influxql/functions/date-time/#time)
- [Miscellaneous](/influxdb/cloud-dedicated/reference/influxql/functions/misc/)
- [fill()](/influxdb/cloud-dedicated/reference/influxql/functions/misc/#fill)
<!-- - [Technical analysis](/influxdb/cloud-dedicated/reference/influxql/functions/technical-analysis/) -->
<!-- - (Predictive analysis) [HOLT_WINTERS()](/influxdb/cloud-dedicated/reference/influxql/functions/technical-analysis/#holt_winters) -->
<!-- - [CHANDE_MOMENTUM_OSCILLATOR()](/influxdb/cloud-dedicated/reference/influxql/functions/technical-analysis/#chande_momentum_oscillator) -->
<!-- - [DOUBLE_EXPONENTIAL_MOVING_AVERAGE()](/influxdb/cloud-dedicated/reference/influxql/functions/technical-analysis/#double_exponential_moving_average) -->
<!-- - [EXPONENTIAL_MOVING_AVERAGE()](/influxdb/cloud-dedicated/reference/influxql/functions/technical-analysis/#exponential_moving_average) -->
<!-- - [KAUFMANS_EFFICIENCY_RATIO()](/influxdb/cloud-dedicated/reference/influxql/functions/technical-analysis/#kaufmans_adaptive_moving_average) -->
<!-- - [KAUFMANS_ADAPTIVE_MOVING_AVERAGE()](/influxdb/cloud-dedicated/reference/influxql/functions/technical-analysis/#kaufmans_adaptive_moving_average) -->
<!-- - [RELATIVE_STRENGTH_INDEX()](/influxdb/cloud-dedicated/reference/influxql/functions/technical-analysis/#relative_strength_index) -->
<!-- - [TRIPLE_EXPONENTIAL_MOVING_AVERAGE()](/influxdb/cloud-dedicated/reference/influxql/functions/technical-analysis/#triple_exponential_moving_average) -->
<!-- - [TRIPLE_EXPONENTIAL_DERIVATIVE()](/influxdb/cloud-dedicated/reference/influxql/functions/technical-analysis/#triple_exponential_derivative) -->

View File

@ -0,0 +1,927 @@
---
title: InfluxQL aggregate functions
list_title: Aggregate functions
description: >
Use InfluxQL aggregate functions to aggregate your time series data.
menu:
influxdb_cloud_dedicated:
name: Aggregates
parent: influxql-functions
weight: 205
---
Use aggregate functions to assess, aggregate, and return values in your data.
Aggregate functions return one row containing the aggregate values from each InfluxQL group.
_Examples use the sample data set provided in the
[Get started with InfluxDB tutorial](/influxdb/cloud-dedicated/get-started/write/#construct-line-protocol)._
- [COUNT()](#count)
- [DISTINCT()](#distinct)
- [MEAN()](#mean)
- [MEDIAN()](#median)
- [STDDEV()](#stddev)
- [SUM()](#sum)
<!-- When implemented, place back in alphabetical order -->
<!-- - [INTEGRAL()](#integral) -->
<!-- - [MODE()](#mode) -->
<!-- - [SPREAD()](#spread) -->
{{% note %}}
#### Missing InfluxQL functions
Some InfluxQL functions are in the process of being rearchitected to work with
the InfluxDB IOx storage engine. If a function you need is not here, check the
[InfluxQL feature support page](/influxdb/cloud-dedicated/reference/influxql/feature-support/#function-support)
for more information.
{{% /note %}}
## COUNT()
Returns the number of non-null [field values](/influxdb/cloud-dedicated/reference/glossary/#field-value).
```sql
COUNT(field_expression)
```
#### Arguments
- **field_expression**: Expression to identify one or more fields to operate on.
Can be a [field key](/influxdb/cloud-dedicated/reference/glossary/#field-key),
constant, regular expression, or wildcard (`*`).
Supports all field types.
#### Examples
{{< expand-wrapper >}}
{{% expand "Count the number of non-null values in a field" %}}
```sql
SELECT COUNT(temp) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | count |
| :------------------- | ----: |
| 1970-01-01T00:00:00Z | 26 |
{{% /expand %}}
{{% expand "Count the number of non-null values in each field" %}}
```sql
SELECT COUNT(*) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | count_co | count_hum | count_temp |
| :------------------- | -------: | --------: | ---------: |
| 1970-01-01T00:00:00Z | 26 | 26 | 26 |
{{% /expand %}}
{{% expand "Count the number of non-null values in fields where the field key matches a regular expression" %}}
```sql
SELECT COUNT(/^[th]/) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | count_hum | count_temp |
| :------------------- | --------: | ---------: |
| 1970-01-01T00:00:00Z | 26 | 26 |
{{% /expand %}}
{{% expand "Count distinct values for a field" %}}
InfluxQL supports nesting [`DISTINCT()`](#distinct) in `COUNT()`.
```sql
SELECT COUNT(DISTINCT(co)) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | count |
| :------------------- | ----: |
| 1970-01-01T00:00:00Z | 12 |
{{% /expand %}}
{{% expand "Count the number of non-null field values within time windows (grouped by time)" %}}
{{% influxdb/custom-timestamps %}}
```sql
SELECT
COUNT(temp)
FROM home
WHERE
room = 'Kitchen'
AND time >= '2022-01-01T08:00:00Z'
AND time <= '2022-01-01T20:00:00Z'
GROUP BY time(6h)
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | count |
| :------------------- | ----: |
| 2022-01-01T06:00:00Z | 4 |
| 2022-01-01T12:00:00Z | 6 |
| 2022-01-01T18:00:00Z | 3 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{< /expand-wrapper >}}
## DISTINCT()
Returns the list of unique [field values](/influxdb/cloud-dedicated/reference/glossary/#field-value).
```sql
DISTINCT(field_key)
```
#### Arguments
- **field_key**: Field key to return distinct values from.
Supports all field types.
#### Notable behaviors
- InfluxQL supports nesting `DISTINCT()` with [`COUNT()`](#count-distinct-values-for-a-field).
#### Examples
{{< expand-wrapper >}}
{{% expand "List the distinct field values" %}}
```sql
SELECT DISTINCT(co) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | distinct |
| :------------------- | -------: |
| 1970-01-01T00:00:00Z | 0 |
| 1970-01-01T00:00:00Z | 1 |
| 1970-01-01T00:00:00Z | 3 |
| 1970-01-01T00:00:00Z | 4 |
| 1970-01-01T00:00:00Z | 7 |
| 1970-01-01T00:00:00Z | 5 |
| 1970-01-01T00:00:00Z | 9 |
| 1970-01-01T00:00:00Z | 18 |
| 1970-01-01T00:00:00Z | 14 |
| 1970-01-01T00:00:00Z | 22 |
| 1970-01-01T00:00:00Z | 17 |
| 1970-01-01T00:00:00Z | 26 |
{{% /expand %}}
{{< /expand-wrapper >}}
<!-- ## INTEGRAL()
Returns the area under the curve for queried [field values](/influxdb/cloud-dedicated/reference/glossary/#field-value)
and converts those results into the summed area per **unit** of time.
{{% note %}}
`INTEGRAL()` does not support [`fill()`](/influxdb/cloud-dedicated/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill).
`INTEGRAL()` supports int64 and float64 field value [data types](/influxdb/cloud-dedicated/reference/glossary/#data-type).
{{% /note %}}
```sql
INTEGRAL(field_expression[, unit])
```
#### Arguments
- **field_expression**: Expression to identify one or more fields to operate on.
Can be a [field key](/influxdb/cloud-dedicated/reference/glossary/#field-key),
constant, regular expression, or wildcard (`*`).
- **unit**: Unit of time to use when calculating the integral.
Default is `1s` (one second).
#### Examples
{{< expand-wrapper >}}
{{% expand "Calculate the integral for a field" %}}
```sql
SELECT
INTEGRAL(co)
FROM home
WHERE room = 'Kitchen'
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | integral |
| :------------------- | -------: |
| 1970-01-01T00:00:00Z | 266400 |
{{% /expand %}}
{{% expand "Calculate the integral for a field and specify the unit option" %}}
```sql
SELECT
INTEGRAL(co, 1h)
FROM home
WHERE room = 'Kitchen'
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | integral |
| :------------------- | -------: |
| 1970-01-01T00:00:00Z | 74 |
{{% /expand %}}
{{% expand "Calculate the integral for _each_ field and specify the unit option" %}}
Return the area under the curve (in minutes) for the field values associated
with each field key that stores numeric values in the `h2o_feet` measurement.
The `h2o_feet` measurement has on numeric field: `water_level`.
```sql
SELECT
INTEGRAL(*, 1h)
FROM home
WHERE room = 'Kitchen'
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | integral_co | integral_hum | integral_temp |
| :------------------- | ----------: | -----------: | ------------: |
| 1970-01-01T00:00:00Z | 74 | 435 | 272.25 |
{{% /expand %}}
{{% expand "Calculate the integral for the field keys that matches a regular expression" %}}
```sql
SELECT
INTEGRAL(/^[th]/, 1h)
FROM home
WHERE room = 'Kitchen'
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | integral_hum | integral_temp |
| :------------------- | -----------: | ------------: |
| 1970-01-01T00:00:00Z | 435 | 272.25 |
{{% /expand %}}
{{% expand "Calculate the integral for a field grouping by time" %}}
{{% influxdb/custom-timestamps %}}
```sql
SELECT
INTEGRAL(co, 1h)
FROM home
WHERE
room = 'Kitchen'
AND time >= '2022-01-01T08:00:00Z'
AND time <= '2022-01-01T20:00:00Z'
GROUP BY time(6h)
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | integral |
| :------------------- | -------: |
| 2022-01-01T06:00:00Z | 0 |
| 2022-01-01T12:00:00Z | 30 |
| 2022-01-01T18:00:00Z | 44 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{< /expand-wrapper >}} -->
## MEAN()
Returns the arithmetic mean (average) of [field values](/influxdb/cloud-dedicated/reference/glossary/#field-value).
```sql
MEAN(field_expression)
```
#### Arguments
- **field_expression**: Expression to identify one or more fields to operate on.
Can be a [field key](/influxdb/cloud-dedicated/reference/glossary/#field-key),
constant, regular expression, or wildcard (`*`).
Supports **numeric fields**.
#### Examples
{{< expand-wrapper >}}
{{% expand "Calculate the mean value of a field" %}}
```sql
SELECT MEAN(temp) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | mean |
| :------------------- | -----------------: |
| 1970-01-01T00:00:00Z | 22.396153846153844 |
{{% /expand %}}
{{% expand "Calculate the mean value of each field" %}}
```sql
SELECT MEAN(*) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | mean_co | mean_hum | mean_temp |
| :------------------- | ----------------: | -------: | -----------------: |
| 1970-01-01T00:00:00Z | 5.269230769230769 | 36.15 | 22.396153846153844 |
{{% /expand %}}
{{% expand "Calculate the mean value of fields where the field key matches a regular expression" %}}
```sql
SELECT MEAN(/^[th]/) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | mean_hum | mean_temp |
| :------------------- | -------: | -----------------: |
| 1970-01-01T00:00:00Z | 36.15 | 22.396153846153844 |
{{% /expand %}}
{{% expand "Calculate the mean value of a field within time windows (grouped by time)" %}}
{{% influxdb/custom-timestamps %}}
```sql
SELECT
MEAN(temp)
FROM home
WHERE
room = 'Kitchen'
AND time >= '2022-01-01T08:00:00Z'
AND time <= '2022-01-01T20:00:00Z'
GROUP BY time(6h)
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | mean |
| :------------------- | -----------------: |
| 2022-01-01T06:00:00Z | 22.275 |
| 2022-01-01T12:00:00Z | 22.649999999999995 |
| 2022-01-01T18:00:00Z | 23.033333333333335 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{< /expand-wrapper >}}
## MEDIAN()
Returns the middle value from a sorted list of [field values](/influxdb/cloud-dedicated/reference/glossary/#field-value).
```sql
MEDIAN(field_expression)
```
#### Arguments
- **field_expression**: Expression to identify one or more fields to operate on.
Can be a [field key](/influxdb/cloud-dedicated/reference/glossary/#field-key),
constant, regular expression, or wildcard (`*`).
Supports **numeric fields**.
#### Notable behaviors
- `MEDIAN()` is nearly equivalent to
[`PERCENTILE(field_key, 50)`](/influxdb/cloud-dedicated/reference/influxql/functions/selectors/#percentile),
except `MEDIAN()` returns the average of the two middle field values if the
field contains an even number of values.
#### Examples
{{< expand-wrapper >}}
{{% expand "Calculate the median value of a field" %}}
```sql
SELECT MEDIAN(temp) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | median |
| :------------------- | -----: |
| 1970-01-01T00:00:00Z | 22.45 |
{{% /expand %}}
{{% expand "Calculate the median value of each field" %}}
```sql
SELECT MEDIAN(*) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | median_co | median_hum | median_temp |
| :------------------- | --------: | ---------: | ----------: |
| 1970-01-01T00:00:00Z | 1 | 36.05 | 22.45 |
{{% /expand %}}
{{% expand "Calculate the median value of fields where the field key matches a regular expression" %}}
```sql
SELECT MEDIAN(/^[th]/) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | median_hum | median_temp |
| :------------------- | ---------: | ----------: |
| 1970-01-01T00:00:00Z | 36.05 | 22.45 |
{{% /expand %}}
{{% expand "Calculate the median value of a field within time windows (grouped by time)" %}}
{{% influxdb/custom-timestamps %}}
```sql
SELECT
MEDIAN(temp)
FROM home
WHERE
room = 'Kitchen'
AND time >= '2022-01-01T08:00:00Z'
AND time <= '2022-01-01T20:00:00Z'
GROUP BY time(6h)
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | median |
| :------------------- | -----------------: |
| 2022-01-01T06:00:00Z | 22.549999999999997 |
| 2022-01-01T12:00:00Z | 22.7 |
| 2022-01-01T18:00:00Z | 23.1 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{< /expand-wrapper >}}
<!-- ## MODE()
Returns the most frequent value in a list of [field values](/influxdb/cloud-dedicated/reference/glossary/#field-value).
```sql
MODE(field_expression)
```
#### Arguments
- **field_expression**: Expression to identify one or more fields to operate on.
Can be a [field key](/influxdb/cloud-dedicated/reference/glossary/#field-key),
constant, regular expression, or wildcard (`*`).
Supports all field types.
#### Notable behaviors
- `MODE()` returns the field value with the earliest
[timestamp](/influxdb/cloud-dedicated/reference/glossary/#timestamp)
if there's a tie between two or more values for the maximum number of occurrences.
#### Examples
{{< expand-wrapper >}}
{{% expand "Calculate the mode value of a field" %}}
```sql
SELECT MODE(co) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | mode |
| :------------------- | ---: |
| 1970-01-01T00:00:00Z | 0 |
{{% /expand %}}
{{% expand "Calculate the mode value of each field" %}}
```sql
SELECT MODE(*) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | mode_co | mode_hum | mode_temp |
| :------------------- | ------: | -------: | --------: |
| 1970-01-01T00:00:00Z | 0 | 36 | 22.7 |
{{% /expand %}}
{{% expand "Calculate the mode of field keys that match a regular expression" %}}
```sql
SELECT MODE(/^[th]/) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | mode_hum | mode_temp |
| :------------------- | -------: | --------: |
| 1970-01-01T00:00:00Z | 36 | 22.7 |
{{% /expand %}}
{{% expand "Calculate the mode a field within time windows (grouped by time)" %}}
{{% influxdb/custom-timestamps %}}
```sql
SELECT
MODE(co)
FROM home
WHERE
room = 'Kitchen'
AND time >= '2022-01-01T08:00:00Z'
AND time <= '2022-01-01T20:00:00Z'
GROUP BY time(6h)
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | mode |
| :------------------- | ---: |
| 2022-01-01T06:00:00Z | 0 |
| 2022-01-01T12:00:00Z | 1 |
| 2022-01-01T18:00:00Z | 18 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{< /expand-wrapper >}} -->
<!-- ## SPREAD()
Returns the difference between the minimum and maximum [field values](/influxdb/cloud-dedicated/reference/glossary/#field-value).
```sql
SPREAD(field_expression)
```
#### Arguments
- **field_expression**: Expression to identify one or more fields to operate on.
Can be a [field key](/influxdb/cloud-dedicated/reference/glossary/#field-key),
constant, regular expression, or wildcard (`*`).
Supports **numeric fields**.
#### Examples
{{< expand-wrapper >}}
{{% expand "Calculate the spread of a field" %}}
```sql
SELECT SPREAD(temp) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | spread |
| :------------------- | -----------------: |
| 1970-01-01T00:00:00Z | 2.3000000000000007 |
{{% /expand %}}
{{% expand "Calculate the spread of each field" %}}
```sql
SELECT SPREAD(*) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | spread_co | spread_hum | spread_temp |
| :------------------- | --------: | ---------: | -----------------: |
| 1970-01-01T00:00:00Z | 26 | 1 | 2.3000000000000007 |
{{% /expand %}}
{{% expand "Calculate the spread of field keys that match a regular expression" %}}
```sql
SELECT SPREAD(/^[th]/) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | spread_hum | spread_temp |
| :------------------- | ---------: | -----------------: |
| 1970-01-01T00:00:00Z | 1 | 2.3000000000000007 |
{{% /expand %}}
{{% expand "Calculate the spread of a field within time windows (grouped by time)" %}}
{{% influxdb/custom-timestamps %}}
```sql
SELECT
SPREAD(co)
FROM home
WHERE
room = 'Kitchen'
AND time >= '2022-01-01T08:00:00Z'
AND time <= '2022-01-01T20:00:00Z'
GROUP BY time(6h)
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | spread |
| :------------------- | -----: |
| 2022-01-01T06:00:00Z | 0 |
| 2022-01-01T12:00:00Z | 9 |
| 2022-01-01T18:00:00Z | 8 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{< /expand-wrapper >}} -->
## STDDEV()
Returns the standard deviation of [field values](/influxdb/cloud-dedicated/reference/glossary/#field-value).
```sql
STDDEV(field_expression)
```
#### Arguments
- **field_expression**: Expression to identify one or more fields to operate on.
Can be a [field key](/influxdb/cloud-dedicated/reference/glossary/#field-key),
constant, regular expression, or wildcard (`*`).
Supports **numeric fields**.
#### Examples
{{< expand-wrapper >}}
{{% expand "Calculate the standard deviation of a field" %}}
```sql
SELECT STDDEV(temp) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | stddev |
| :------------------- | -----------------: |
| 1970-01-01T00:00:00Z | 0.5553238833191091 |
{{% /expand %}}
{{% expand "Calculate the standard deviation of each field" %}}
```sql
SELECT STDDEV(*) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | stddev_co | stddev_hum | stddev_temp |
| :------------------- | ----------------: | ------------------: | -----------------: |
| 1970-01-01T00:00:00Z | 7.774613519951676 | 0.25495097567963926 | 0.5553238833191091 |
{{% /expand %}}
{{% expand "Calculate the standard deviation of fields where the field key matches a regular expression" %}}
```sql
SELECT STDDEV(/^[th]/) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | stddev_hum | stddev_temp |
| :------------------- | ------------------: | -----------------: |
| 1970-01-01T00:00:00Z | 0.25495097567963926 | 0.5553238833191091 |
{{% /expand %}}
{{% expand "Calculate the standard deviation of a field within time windows (grouped by time)" %}}
{{% influxdb/custom-timestamps %}}
```sql
SELECT
STDDEV(co)
FROM home
WHERE
room = 'Kitchen'
AND time >= '2022-01-01T08:00:00Z'
AND time <= '2022-01-01T20:00:00Z'
GROUP BY time(6h)
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | stddev |
| :------------------- | -----------------: |
| 2022-01-01T06:00:00Z | 0 |
| 2022-01-01T12:00:00Z | 3.6742346141747673 |
| 2022-01-01T18:00:00Z | 4 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{< /expand-wrapper >}}
## SUM()
Returns the sum of [field values](/influxdb/cloud-dedicated/reference/glossary/#field-value).
```sql
SUM(field_expression)
```
#### Arguments
- **field_expression**: Expression to identify one or more fields to operate on.
Can be a [field key](/influxdb/cloud-dedicated/reference/glossary/#field-key),
constant, regular expression, or wildcard (`*`).
Supports **numeric fields**.
#### Examples
{{< expand-wrapper >}}
{{% expand "Calculate the sum of values in a field" %}}
```sql
SELECT SUM(co) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | sum |
| :------------------- | --: |
| 1970-01-01T00:00:00Z | 137 |
{{% /expand %}}
{{% expand "Calculate the sum of values in each field" %}}
```sql
SELECT SUM(*) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | sum_co | sum_hum | sum_temp |
| :------------------- | -----: | ------: | -------: |
| 1970-01-01T00:00:00Z | 137 | 939.9 | 582.3 |
{{% /expand %}}
{{% expand "Calculate the sum of values for fields where the field key matches a regular expression" %}}
```sql
SELECT SUM(/^[th]/) FROM home
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | sum_hum | sum_temp |
| :------------------- | ------: | -------: |
| 1970-01-01T00:00:00Z | 939.9 | 582.3 |
{{% /expand %}}
{{% expand "Calculate the sum of values in a field within time windows (grouped by time)" %}}
{{% influxdb/custom-timestamps %}}
```sql
SELECT
SUM(co)
FROM home
WHERE
room = 'Kitchen'
AND time >= '2022-01-01T08:00:00Z'
AND time <= '2022-01-01T20:00:00Z'
GROUP BY time(6h)
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | sum |
| :------------------- | --: |
| 2022-01-01T06:00:00Z | 0 |
| 2022-01-01T12:00:00Z | 21 |
| 2022-01-01T18:00:00Z | 66 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -0,0 +1,145 @@
---
title: InfluxQL date and time functions
list_title: Date and time functions
description: >
Use InfluxQL date and time functions to perform time-related operations.
menu:
influxdb_cloud_dedicated:
name: Date and time
parent: influxql-functions
weight: 206
---
Use InfluxQL date and time functions to perform time-related operations.
- [now()](#now)
- [time()](#time)
<!-- - [tz()](#tz) -->
## now()
Returns the current system time (UTC).
_Supported only in the [`WHERE` clause](/influxdb/cloud-dedicated/reference/influxql/where/)._
```sql
now()
```
## time()
Used in the [`GROUP BY` clause](/influxdb/cloud-dedicated/reference/influxql/group-by/)
to group data into time-based intervals, also known as "windows", using the specified interval.
Timestamps in the `time` column are updated to the start boundary of the window
they're in and grouped by `time`.
Windows use preset round-number boundaries based on the specified interval that
are independent of time conditions in the
[`WHERE` clause](/influxdb/cloud-dedicated/reference/influxql/where/).
This operation can be used to do the following:
- Downsample data by aggregating multiple points in each window into a single
point per window.
- Normalize irregular time series data to occur at regular intervals.
_Supported only in the [`GROUP BY` clause](/influxdb/cloud-dedicated/reference/influxql/group-by/)._
```sql
time(interval[, offset])
```
#### Arguments
- **interval**: Duration literal that specifies the window interval.
- **offset**: Duration literal that shifts preset time boundaries forward or backward.
Can be positive or negative. _Default is `0s`._
##### Examples {#time-examples}
{{< expand-wrapper >}}
{{% expand "Downsample data into time-based intervals" %}}
The following example uses the
[Bitcoin price sample dataset](/influxdb/cloud-dedicated/reference/sample-data/#bitcoin-price-data).
```sql
SELECT
MEAN(price)
FROM bitcoin
WHERE
code = 'GBP'
AND time >= '2023-05-01T00:00:00Z'
AND time < '2023-05-15T00:00:00Z'
GROUP BY time(2d)
```
{{% influxql/table-meta %}}
name: bitcoin
{{% /influxql/table-meta %}}
| time | mean |
| :------------------- | -----------------: |
| 2023-05-01T00:00:00Z | 23680.120447159094 |
| 2023-05-03T00:00:00Z | 24048.71484033149 |
| 2023-05-05T00:00:00Z | 24461.9194901099 |
| 2023-05-07T00:00:00Z | 23796.43801933702 |
| 2023-05-09T00:00:00Z | 23118.709889285707 |
| 2023-05-11T00:00:00Z | 22465.008364444446 |
| 2023-05-13T00:00:00Z | 22499.464763186803 |
{{% /expand %}}
{{< /expand-wrapper >}}
<!-- ## tz()
Applies a timezone offset to timestamps in query results.
Offsets include any seasonal offset such as Daylight Savings Time (DST) or
British Summer Time (BST).
_Supported only in the [time zone clause](/influxdb/cloud-dedicated/reference/influxql/time-and-timezone/#time-zone-clause)._
```sql
tz(time_zone)
```
#### Arguments
- **time_zone**: Timezone string literal to adjust times to.
Uses timezone names defined in the
[Internet Assigned Numbers Authority time zone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List).
#### Examples {#tz-examples}
{{< expand-wrapper >}}
{{% expand "Return the UTC offset for Chicago's time zone" %}}
The following example uses the
[Get started home sensor sample dataset](/influxdb/cloud-dedicated/reference/sample-data/#get-started-home-sensor-data).
{{% influxdb/custom-timestamps %}}
```sql
SELECT *
FROM home
WHERE
room = 'Kitchen'
AND time >= '2022-01-01T08:00:00Z'
AND time <= '2022-01-01T12:00:00Z'
tz('America/Chicago')
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | co | hum | room | temp |
| :------------------------ | --: | ---: | :------ | ---: |
| 2022-01-01T02:00:00-06:00 | 0 | 35.9 | Kitchen | 21 |
| 2022-01-01T03:00:00-06:00 | 0 | 36.2 | Kitchen | 23 |
| 2022-01-01T04:00:00-06:00 | 0 | 36.1 | Kitchen | 22.7 |
| 2022-01-01T05:00:00-06:00 | 0 | 36 | Kitchen | 22.4 |
| 2022-01-01T06:00:00-06:00 | 0 | 36 | Kitchen | 22.5 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{< /expand-wrapper >}} -->

View File

@ -0,0 +1,246 @@
---
title: InfluxQL miscellaneous functions
list_title: Miscellaneous functions
description: >
Use InfluxQL miscellaneous functions to perform different operations in
InfluxQL queries.
menu:
influxdb_cloud_dedicated:
name: Miscellaneous
identifier: influxql-misc-functions
parent: influxql-functions
weight: 206
---
Use InfluxQL miscellaneous functions to perform different operations in
InfluxQL queries.
- [fill()](#fill)
## fill()
Fills _null_ field values returned from empty time windows in `GROUP BY time()`
queries with a specified fill value.
_Supported only in the [`GROUP BY` clause](/influxdb/cloud-dedicated/reference/influxql/group-by/)._
```sql
fill(behavior)
```
#### Arguments
- **behavior**: Defines the behavior of the fill operation.
If no `FILL` clause is included, the default behavior is `fill(null)`.
The following options are available:
- **numeric literal**: Replaces null values with the specified numeric literal.
- **linear**: Uses linear interpolation between existing values to replace null values.
- **none**: Removes rows with null field values.
- **null**: Keeps null values and associated timestamps.
- **previous**: Replaces null values with the most recent non-null value.
#### Examples {#fill-examples}
The following example uses the
[Bitcoin price sample dataset](/influxdb/cloud-dedicated/reference/sample-data/#bitcoin-price-data).
{{< tabs-wrapper >}}
{{% tabs "small" %}}
[fill(numeric_literal)](#)
[fill(linear)](#)
[fill(none)](#)
[fill(null)](#)
[fill(previous)](#)
{{% /tabs %}}
{{% tab-content %}}
```sql
SELECT
MEAN(price)
FROM bitcoin
WHERE
code = 'USD'
AND time >= '2023-05-01T00:00:00Z'
AND time < '2023-05-01T02:00:00Z'
GROUP BY
time(30m)
fill(0)
```
{{% influxql/table-meta %}}
name: bitcoin
{{% /influxql/table-meta %}}
| time | mean |
| :------------------- | ---------: |
| 2023-05-01T00:00:00Z | 29319.9092 |
| 2023-05-01T00:30:00Z | 29307.4416 |
| 2023-05-01T01:00:00Z | 0 |
| 2023-05-01T01:30:00Z | 29263.2886 |
{{% /tab-content %}}
{{% tab-content %}}
```sql
SELECT
MEAN(price)
FROM bitcoin
WHERE
code = 'USD'
AND time >= '2023-05-01T00:00:00Z'
AND time < '2023-05-01T02:00:00Z'
GROUP BY
time(30m)
fill(linear)
```
{{% influxql/table-meta %}}
name: bitcoin
{{% /influxql/table-meta %}}
| time | mean |
| :------------------- | ---------: |
| 2023-05-01T00:00:00Z | 29319.9092 |
| 2023-05-01T00:30:00Z | 29307.4416 |
| 2023-05-01T01:00:00Z | 29285.3651 |
| 2023-05-01T01:30:00Z | 29263.2886 |
{{% /tab-content %}}
{{% tab-content %}}
```sql
SELECT
MEAN(price)
FROM bitcoin
WHERE
code = 'USD'
AND time >= '2023-05-01T00:00:00Z'
AND time < '2023-05-01T02:00:00Z'
GROUP BY
time(30m)
fill(none)
```
{{% influxql/table-meta %}}
name: bitcoin
{{% /influxql/table-meta %}}
| time | mean |
| :------------------- | ---------: |
| 2023-05-01T00:00:00Z | 29319.9092 |
| 2023-05-01T00:30:00Z | 29307.4416 |
| 2023-05-01T01:30:00Z | 29263.2886 |
{{% /tab-content %}}
{{% tab-content %}}
```sql
SELECT
MEAN(price)
FROM bitcoin
WHERE
code = 'USD'
AND time >= '2023-05-01T00:00:00Z'
AND time < '2023-05-01T02:00:00Z'
GROUP BY
time(30m)
fill(null)
```
{{% influxql/table-meta %}}
name: bitcoin
{{% /influxql/table-meta %}}
| time | mean |
| :------------------- | ---------: |
| 2023-05-01T00:00:00Z | 29319.9092 |
| 2023-05-01T00:30:00Z | 29307.4416 |
| 2023-05-01T01:00:00Z | |
| 2023-05-01T01:30:00Z | 29263.2886 |
{{% /tab-content %}}
{{% tab-content %}}
```sql
SELECT
MEAN(price)
FROM bitcoin
WHERE
code = 'USD'
AND time >= '2023-05-01T00:00:00Z'
AND time < '2023-05-01T02:00:00Z'
GROUP BY
time(30m)
fill(previous)
```
{{% influxql/table-meta %}}
name: bitcoin
{{% /influxql/table-meta %}}
| time | mean |
| :------------------- | ---------: |
| 2023-05-01T00:00:00Z | 29319.9092 |
| 2023-05-01T00:30:00Z | 29307.4416 |
| 2023-05-01T01:00:00Z | 29307.4416 |
| 2023-05-01T01:30:00Z | 29263.2886 |
{{% /tab-content %}}
{{< /tabs-wrapper >}}
<!-- ## tz()
Applies a timezone offset to timestamps in query results.
Offsets include any seasonal offset such as Daylight Savings Time (DST) or
British Summer Time (BST).
_Supported only in the [time zone clause](/influxdb/cloud-dedicated/reference/influxql/time-and-timezone/#time-zone-clause)._
```sql
tz(time_zone)
```
#### Arguments
- **time_zone**: Timezone string literal to adjust times to.
Uses timezone names defined in the
[Internet Assigned Numbers Authority time zone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List).
#### Examples {#tz-examples}
{{< expand-wrapper >}}
{{% expand "Return the UTC offset for Chicago's time zone" %}}
The following example uses the
[Get started home sensor sample dataset](/influxdb/cloud-dedicated/reference/sample-data/#get-started-home-sensor-data).
{{% influxdb/custom-timestamps %}}
```sql
SELECT *
FROM home
WHERE
room = 'Kitchen'
AND time >= '2022-01-01T08:00:00Z'
AND time <= '2022-01-01T12:00:00Z'
tz('America/Chicago')
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | co | hum | room | temp |
| :------------------------ | --: | ---: | :------ | ---: |
| 2022-01-01T02:00:00-06:00 | 0 | 35.9 | Kitchen | 21 |
| 2022-01-01T03:00:00-06:00 | 0 | 36.2 | Kitchen | 23 |
| 2022-01-01T04:00:00-06:00 | 0 | 36.1 | Kitchen | 22.7 |
| 2022-01-01T05:00:00-06:00 | 0 | 36 | Kitchen | 22.4 |
| 2022-01-01T06:00:00-06:00 | 0 | 36 | Kitchen | 22.5 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{< /expand-wrapper >}} -->

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,612 @@
---
title: GROUP BY clause
description: >
Use the `GROUP BY` clause to group data by one or more specified
[tags](/influxdb/cloud-dedicated/reference/glossary/#tag) or into specified time intervals.
menu:
influxdb_cloud_dedicated:
name: GROUP BY clause
identifier: influxql-group-by
parent: influxql-reference
weight: 203
list_code_example: |
```sql
SELECT_clause FROM_clause [WHERE_clause] GROUP BY group_expression[, ..., group_expression_n]
```
---
Use the `GROUP BY` clause to group data by one or more specified
[tags](/influxdb/cloud-dedicated/reference/glossary/#tag) or into specified time intervals.
`GROUP BY` requires an [aggregate](/influxdb/cloud-dedicated/reference/influxql/functions/aggregates/)
or [selector](/influxdb/cloud-dedicated/reference/influxql/functions/selectors/)
function in the `SELECT` statement.
- [Syntax](#syntax)
- [GROUP BY tags examples](#group-by-tags-examples)
- [GROUP BY time](#group-by-time)
- [GROUP by time and fill gaps](#group-by-time-and-fill-gaps)
- [GROUP BY time examples](#group-by-time-examples)
- [Notable behaviors of the GROUP BY clause](#notable-behaviors-of-the-group-by-clause)
- [Cannot group by fields](#cannot-group-by-fields)
- [Tag order does not matter](#tag-order-does-not-matter)
- [Grouping by tag and no time range returns unexpected timestamps](#grouping-by-tag-and-no-time-range-returns-unexpected-timestamps)
- [Data grouped by time may return unexpected timestamps](#data-grouped-by-time-may-return-unexpected-timestamps)
- [Fill with no data in the queried time range](#fill-with-no-data-in-the-queried-time-range)
- [Fill with previous if no previous value exists](#fill-with-previous-if-no-previous-value-exists)
- [Fill with linear interpolation if there are not two values to interpolate between](#fill-with-linear-interpolation-if-there-are-not-two-values-to-interpolate-between)
## Syntax
```sql
SELECT_clause FROM_clause [WHERE_clause] GROUP BY group_expression[, ..., group_expression_n]
```
- **group_expression**: Expression to identify tags or time intervals to group by.
Can be a [tag key](/influxdb/cloud-dedicated/reference/glossary/#tag-key),
constant, [regular expression](/influxdb/cloud-dedicated/reference/influxql/regular-expressions/),
wildcard (`*`), or [function](/influxdb/cloud-dedicated/reference/influxql/functions/).
#### GROUP BY clause behaviors
- `GROUP BY tag_key` - Groups data by a specific tag
- `GROUP BY tag_key1, tag_key2` - Groups data by more than one tag
- `GROUP BY *` - Groups data by all [tags](/influxdb/v2.7/reference/glossary/#tag)
- `GROUP BY /regex/` - Groups data by tag keys that match the regular expression
- `GROUP BY time()` - Groups data into time intervals (windows)
{{% note %}}
If a query includes `WHERE` and `GROUP BY`, the `GROUP BY` clause must appear after
the `WHERE` clause.
{{% /note %}}
### GROUP BY tags examples
The following examples use the
[Bitcoin price sample data](/influxdb/cloud-dedicated/reference/sample-data/#bitcoin-price-data).
{{< expand-wrapper >}}
{{% expand "Group data by a single tag" %}}
```sql
SELECT MEAN(*) FROM bitcoin GROUP BY code
```
{{% influxql/table-meta %}}
name: bitcoin
tags: code=EUR
{{% /influxql/table-meta %}}
| time | mean_price |
| :------------------- | -----------------: |
| 1970-01-01T00:00:00Z | 27328.848667840004 |
{{% influxql/table-meta %}}
name: bitcoin
tags: code=GBP
{{% /influxql/table-meta %}}
| time | mean_price |
| :------------------- | -----------------: |
| 1970-01-01T00:00:00Z | 23441.832453919982 |
{{% influxql/table-meta %}}
name: bitcoin
tags: code=USD
{{% /influxql/table-meta %}}
| time | mean_price |
| :------------------- | -----------------: |
| 1970-01-01T00:00:00Z | 28054.160950480004 |
{{% /expand %}}
{{% expand "Group data by more than one tag" %}}
```sql
SELECT MEAN(*) FROM bitcoin GROUP BY code, description
```
{{% influxql/table-meta %}}
name: bitcoin
tags: code=EUR, description=Euro
{{% /influxql/table-meta %}}
| time | mean_price |
| :------------------- | -----------------: |
| 1970-01-01T00:00:00Z | 27328.848667840004 |
{{% influxql/table-meta %}}
name: bitcoin
tags: code=GBP, description=British Pound Sterling
{{% /influxql/table-meta %}}
| time | mean_price |
| :------------------- | -----------------: |
| 1970-01-01T00:00:00Z | 23441.832453919982 |
{{% influxql/table-meta %}}
name: bitcoin
tags: code=USD, description=United States Dollar
{{% /influxql/table-meta %}}
| time | mean_price |
| :------------------- | -----------------: |
| 1970-01-01T00:00:00Z | 28054.160950480004 |
{{% /expand %}}
{{% expand "Group data by all tags" %}}
```sql
SELECT MEAN(*) FROM bitcoin GROUP BY *
```
{{% influxql/table-meta %}}
name: bitcoin
tags: code=EUR, crypto=bitcoin, description=Euro, symbol=&euro;
{{% /influxql/table-meta %}}
| time | mean_price |
| :------------------- | -----------------: |
| 1970-01-01T00:00:00Z | 27328.848667840004 |
{{% influxql/table-meta %}}
name: bitcoin
tags: code=GBP, crypto=bitcoin, description=British Pound Sterling, symbol=&pound;
{{% /influxql/table-meta %}}
| time | mean_price |
| :------------------- | -----------------: |
| 1970-01-01T00:00:00Z | 23441.832453919982 |
{{% influxql/table-meta %}}
name: bitcoin
tags: code=USD, crypto=bitcoin, description=United States Dollar, symbol=&#36;
{{% /influxql/table-meta %}}
| time | mean_price |
| :------------------- | -----------------: |
| 1970-01-01T00:00:00Z | 28054.160950480004 |
{{% /expand %}}
{{% expand "Group data by tag keys that match a regular expression" %}}
```sql
SELECT MEAN(*) FROM bitcoin GROUP BY /^[cd]/
```
{{% influxql/table-meta %}}
name: bitcoin
tags: code=EUR, crypto=bitcoin, description=Euro
{{% /influxql/table-meta %}}
| time | mean_price |
| :------------------- | -----------------: |
| 1970-01-01T00:00:00Z | 27328.848667840004 |
{{% influxql/table-meta %}}
name: bitcoin
tags: code=GBP, crypto=bitcoin, description=British Pound Sterling
{{% /influxql/table-meta %}}
| time | mean_price |
| :------------------- | -----------------: |
| 1970-01-01T00:00:00Z | 23441.832453919982 |
{{% influxql/table-meta %}}
name: bitcoin
tags: code=USD, crypto=bitcoin, description=United States Dollar
{{% /influxql/table-meta %}}
| time | mean_price |
| :------------------- | -----------------: |
| 1970-01-01T00:00:00Z | 28054.160950480004 |
{{% /expand %}}
{{< /expand-wrapper >}}
## GROUP BY time
`GROUP BY time()` groups data by into specified time intervals, also known as "windows",
and applies the [aggregate](/influxdb/cloud-dedicated/reference/influxql/functions/aggregates/)
and [selector](/influxdb/cloud-dedicated/reference/influxql/functions/selectors/)
functions in the `SELECT` clause to each interval.
Use the [`time()` function](/influxdb/cloud-dedicated/reference/influxql/functions/date-time/#time)
to specify the time interval to group by.
```sql
SELECT_clause FROM_clause WHERE <time_range> GROUP BY time(time_interval[, offset])[, group_expression (...)] [fill(behavior)]
```
`GROUP BY time()` intervals use preset round-number time boundaries that
are independent of time conditions in the [`WHERE` clause](/influxdb/cloud-dedicated/reference/influxql/where/).
**Output data uses window start boundaries as the aggregate timestamps.**
Use the `offset` argument of the `time()` function to shift time boundaries forward or
backward in time.
### GROUP by time and fill gaps
When grouping by time, if a window in the queried time range does not contain data,
results return a row for the empty window containing the timestamp of the empty
window and _null_ values for each queried field.
Use the [`fill()` function](/influxdb/cloud-dedicated/reference/influxql/functions/misc/#fill)
_at the end of the `GROUP BY` clause_ to replace _null_ field values.
If no `FILL` clause is included, the default behavior is `fill(null)`.
`fill()` provides the following behaviors for filling values:
- **numeric literal**: Replaces null values with the specified numeric literal.
- **linear**: Uses linear interpolation between existing values to replace null values.
- **none**: Removes rows with null field values.
- **null**: Keeps null values and associated timestamps.
- **previous**: Replaces null values with the most recent non-null value.
_See the [`fill()` documentation](/influxdb/cloud-dedicated/reference/influxql/functions/misc/#fill)
for detailed examples._
### GROUP BY time examples
The following examples use the
[Bitcoin price sample data](/influxdb/cloud-dedicated/reference/sample-data/#bitcoin-price-data).
{{< expand-wrapper >}}
{{% expand "Group and aggregate query results into 1 hour windows" %}}
```sql
SELECT
MEAN(price)
FROM bitcoin
WHERE
code = 'USD'
AND time >= '2023-05-01T00:00:00Z'
AND time < '2023-05-15T00:00:00Z'
GROUP BY time(1h)
```
{{% influxql/table-meta %}}
name: bitcoin
{{% /influxql/table-meta %}}
| time | mean |
| :------------------- | -----------------: |
| 2023-05-01T00:00:00Z | 24494.27265 |
| 2023-05-01T01:00:00Z | 24452.1698 |
| 2023-05-01T02:00:00Z | 23902.666124999996 |
| 2023-05-01T03:00:00Z | 23875.211349999998 |
| 2023-05-01T04:00:00Z | 23855.6441 |
| ... | ... |
{{% /expand %}}
{{% expand "Group and aggregate query results into 1 week intervals by tag" %}}
```sql
SELECT
MEAN(price)
FROM bitcoin
WHERE
time >= '2023-05-01T00:00:00Z'
AND time < '2023-05-15T00:00:00Z'
GROUP BY time(1w), code
```
{{% influxql/table-meta %}}
name: bitcoin
tags: code=EUR
{{% /influxql/table-meta %}}
| time | mean |
| :------------------- | -----------------: |
| 2023-04-27T00:00:00Z | 27681.21808576779 |
| 2023-05-04T00:00:00Z | 27829.413580354256 |
| 2023-05-11T00:00:00Z | 26210.24799033149 |
{{% influxql/table-meta %}}
name: bitcoin
tags: code=GBP
{{% /influxql/table-meta %}}
| time | mean |
| :------------------- | -----------------: |
| 2023-04-27T00:00:00Z | 23744.083925842704 |
| 2023-05-04T00:00:00Z | 23871.201395652173 |
| 2023-05-11T00:00:00Z | 22482.33174723755 |
{{% influxql/table-meta %}}
name: bitcoin
tags: code=USD
{{% /influxql/table-meta %}}
| time | mean |
| :------------------- | -----------------: |
| 2023-04-27T00:00:00Z | 28415.88231123595 |
| 2023-05-04T00:00:00Z | 28568.010941384844 |
| 2023-05-11T00:00:00Z | 26905.87242099449 |
{{% /expand %}}
{{< /expand-wrapper >}}
###### GROUP BY time with offset
{{< expand-wrapper >}}
{{% expand "Group and aggregate query results into 1 hour intervals and offset time boundaries by +15 minutes" %}}
```sql
SELECT
MEAN(price)
FROM bitcoin
WHERE
code = 'USD'
AND time >= '2023-05-01T00:00:00Z'
AND time < '2023-05-02T00:00:00Z'
GROUP BY time(1h, 15m)
```
{{% influxql/table-meta %}}
name: bitcoin
{{% /influxql/table-meta %}}
| time | mean |
| :------------------- | -----------------: |
| 2023-04-30T23:15:00Z | |
| 2023-05-01T00:15:00Z | 29313.6754 |
| 2023-05-01T01:15:00Z | 28932.0882 |
| 2023-05-01T02:15:00Z | 28596.375225000003 |
| 2023-05-01T03:15:00Z | 28578.915075 |
| ... | ... |
_Note that `offset` forces the first time boundary to be outside
the queried time range so the query returns no results for that first interval._
{{% /expand %}}
{{% expand "Group and aggregate query results into 1 hour intervals and offset time boundaries by -15 minutes" %}}
```sql
SELECT
MEAN(price)
FROM bitcoin
WHERE
code = 'USD'
AND time >= '2023-05-01T00:00:00Z'
AND time < '2023-05-02T00:00:00Z'
GROUP BY time(1h, -15m)
```
{{% influxql/table-meta %}}
name: bitcoin
{{% /influxql/table-meta %}}
| time | mean |
| :------------------- | -----------------: |
| 2023-04-30T23:45:00Z | 29319.9092 |
| 2023-05-01T00:45:00Z | 29285.3651 |
| 2023-05-01T01:45:00Z | 28607.202666666668 |
| 2023-05-01T02:45:00Z | 28576.056175 |
| 2023-05-01T03:45:00Z | 28566.96315 |
| ... | ... |
{{% /expand %}}
{{< /expand-wrapper >}}
###### GROUP BY time and fill gaps
{{< expand-wrapper >}}
{{% expand "Group and aggregate query results into 30 minute intervals and fill gaps with `0`" %}}
```sql
SELECT
MEAN(price)
FROM bitcoin
WHERE
code = 'USD'
AND time >= '2023-05-01T00:00:00Z'
AND time < '2023-05-01T02:00:00Z'
GROUP BY
time(30m)
fill(0)
```
{{% influxql/table-meta %}}
name: bitcoin
{{% /influxql/table-meta %}}
| time | mean |
| -------------------- | ---------- |
| 2023-05-01T00:00:00Z | 29319.9092 |
| 2023-05-01T00:30:00Z | 29307.4416 |
| 2023-05-01T01:00:00Z | 0 |
| 2023-05-01T01:30:00Z | 29263.2886 |
{{% /expand %}}
{{% expand "Group and aggregate query results into 30 minute intervals and fill gaps using linear interpolation" %}}
```sql
SELECT
MEAN(price)
FROM bitcoin
WHERE
code = 'USD'
AND time >= '2023-05-01T00:00:00Z'
AND time < '2023-05-01T02:00:00Z'
GROUP BY
time(30m)
fill(linear)
```
{{% influxql/table-meta %}}
name: bitcoin
{{% /influxql/table-meta %}}
| time | mean |
| -------------------- | ---------- |
| 2023-05-01T00:00:00Z | 29319.9092 |
| 2023-05-01T00:30:00Z | 29307.4416 |
| 2023-05-01T01:00:00Z | 29285.3651 |
| 2023-05-01T01:30:00Z | 29263.2886 |
{{% /expand %}}
{{% expand "Group and aggregate query results into 30 minute intervals and fill gaps with previous values" %}}
```sql
SELECT
MEAN(price)
FROM bitcoin
WHERE
code = 'USD'
AND time >= '2023-05-01T00:00:00Z'
AND time < '2023-05-01T02:00:00Z'
GROUP BY
time(30m)
fill(previous)
```
{{% influxql/table-meta %}}
name: bitcoin
{{% /influxql/table-meta %}}
| time | mean |
| -------------------- | ---------- |
| 2023-05-01T00:00:00Z | 29319.9092 |
| 2023-05-01T00:30:00Z | 29307.4416 |
| 2023-05-01T01:00:00Z | 29307.4416 |
| 2023-05-01T01:30:00Z | 29263.2886 |
{{% /expand %}}
{{< /expand-wrapper >}}
## Notable behaviors of the GROUP BY clause
### Cannot group by fields
InfluxQL does not support grouping data by **fields**.
### Tag order does not matter
The order that tags are listed in the `GROUP BY` clause does not affect how
data is grouped.
### Grouping by tag and no time range returns unexpected timestamps
When grouping by tags and no time range is specified in the
[`WHERE` clause](/influxdb/cloud-dedicated/reference/influxql/where/), results
use the [Unix epoch](/influxdb/cloud-dedicated/reference/glossary/#unix-epoch) as the default timestamp for the aggregate timestamp.
For example:
```sql
SELECT mean(temp) FROM home GROUP BY room
```
{{% influxql/table-meta %}}
name: home
tags: room=Kitchen
{{% /influxql/table-meta %}}
| time | mean |
| :------------------- | -----------------: |
| 1970-01-01T00:00:00Z | 22.623076923076926 |
{{% influxql/table-meta %}}
name: home
tags: room=Living Room
{{% /influxql/table-meta %}}
| time | mean |
| :------------------- | ----------------: |
| 1970-01-01T00:00:00Z | 22.16923076923077 |
### Data grouped by time may return unexpected timestamps
Because `GROUP BY time()` intervals use preset round-number time boundaries that
are independent of time conditions in the [`WHERE` clause](/influxdb/cloud-dedicated/reference/influxql/where/),
results may include timestamps outside of the queried time range.
Results represent only data with timestamps in the specified time range, but
output timestamps are determined by by the preset time boundaries.
The following example groups data by 1-hour intervals, but the time range defined
in the `WHERE` clause covers only part of a window:
```sql
SELECT MEAN(field)
FROM example
WHERE
time >= '2022-01-01T00:30:00Z'
AND time <= '2022-01-01T01:30:00Z'
GROUP BY time(1h)
```
{{% note %}}
**Note**: The timestamp in the first row of query results data occurs before the start of
the queried time range.
[See why](#why-do-these-results-include-timestamps-outside-of-the-queried-time-range).
{{% /note %}}
{{% influxdb/custom-timestamps %}}
{{< flex >}}
{{% flex-content %}}
#### Example data
| time | field |
| :------------------- | ----: |
| 2022-01-01T00:00:00Z | 8 |
| 2022-01-01T00:15:00Z | 4 |
| 2022-01-01T00:30:00Z | 0 |
| 2022-01-01T00:45:00Z | 8 |
| 2022-01-01T01:00:00Z | 5 |
| 2022-01-01T01:15:00Z | 0 |
| 2022-01-01T01:30:00Z | 8 |
| 2022-01-01T01:45:00Z | 8 |
| 2022-01-01T02:00:00Z | 9 |
| 2022-01-01T02:15:00Z | 6 |
| 2022-01-01T02:30:00Z | 3 |
| 2022-01-01T02:45:00Z | 0 |
{{% /flex-content %}}
{{% flex-content %}}
#### Query results
| time | field |
| :------------------- | ----: |
| 2022-01-01T00:00:00Z | 4 |
| 2022-01-01T01:00:00Z | 5.25 |
| 2022-01-01T02:00:00Z | 6 |
{{% /flex-content %}}
{{< /flex >}}
{{% /influxdb/custom-timestamps %}}
{{< expand-wrapper >}}
{{% expand "Why do these results include timestamps outside of the queried time range?" %}}
`GROUP BY time()` creates windows with predefined time boundaries based on the
specified interval. These boundaries are not determined by the queried time
range, however, aggregate values in query results are calculated using only
values that are in the queried time range.
{{< html-diagram/influxql-windows >}}
{{% /expand %}}
{{< /expand-wrapper >}}
### Fill with no data in the queried time range
Queries ignore `fill()` if no data exists in the queried time range.
This is the expected behavior.
### Fill with previous if no previous value exists
`fill(previous)` doesnt fill null values if there is no previous value in
the queried time range.
### Fill with linear interpolation if there are not two values to interpolate between
`fill(linear)` doesn't fill null values if there are no values before or after
the null value in the queried time range.

View File

@ -0,0 +1,164 @@
---
title: InfluxQL internals
description: Read about the implementation of InfluxQL.
menu:
influxdb_cloud_dedicated:
name: InfluxQL internals
parent: influxql-reference
weight: 219
---
Learn about the implementation of InfluxQL to understand how
results are processed and how to create efficient queries:
- [Query life cycle](#query-life-cycle)
- [Understanding iterators](#understanding-iterators)
- [Cursors](#cursors)
- [Auxiliary fields](#auxiliary-fields)
- [Built-in iterators](#built-in-iterators)
- [Call iterators](#call-iterators)
## Query life cycle
1. InfluxQL query string is tokenized and then parsed into an abstract syntax
tree (AST). This is the code representation of the query itself.
2. The AST is passed to the `QueryExecutor` which directs queries to the
appropriate handlers. For example, queries related to meta data are executed
by the **meta service** and `SELECT` statements are executed by the shards
themselves.
3. The query engine then determines the shards that match the `SELECT`
statement's time range. From these shards, iterators are created for each
field in the statement.
4. Iterators are passed to the emitter which drains them and joins the resulting
points. The emitter's job is to convert simple time/value points into the
more complex result objects that are returned to the client.
### Understanding iterators
Iterators provide a simple interface for looping over a set of points.
For example, this is an iterator over Float points:
```
type FloatIterator interface {
Next() *FloatPoint
}
```
These iterators are created through the `IteratorCreator` interface:
```
type IteratorCreator interface {
CreateIterator(opt *IteratorOptions) (Iterator, error)
}
```
The `IteratorOptions` provide arguments about field selection, time ranges,
and dimensions that the iterator creator can use when planning an iterator.
The `IteratorCreator` interface is used at many levels such as the `Shards`,
`Shard`, and `Engine`. This allows optimizations to be performed when applicable
such as returning a precomputed `COUNT()`.
Iterators aren't just for reading raw data from storage, though. Iterators can be
composed so that they provide additional functionality around an input
iterator. For example, a `DistinctIterator` can compute the distinct values for
each time window for an input iterator. Or a `FillIterator` can generate
additional points that are missing from an input iterator.
This composition also lends itself well to aggregation.
For example, in the following SQL, `MEAN(value)` is a `MeanIterator` that wraps an iterator from the
underlying shards:
```sql
SELECT MEAN(value) FROM cpu GROUP BY time(10m)
```
The following example wraps `MEAN(value)` with an additional iterator (`DERIVATIVE()`) to determine
the derivative of the mean:
```sql
SELECT DERIVATIVE(MEAN(value), 20m) FROM cpu GROUP BY time(10m)
```
### Cursors
A **cursor** identifies data by shard in tuples (time, value) for a single series (measurement, tag set and field). The cursor traverses data stored as a log-structured merge-tree and handles deduplication across levels, tombstones for deleted data, and merging the cache (Write Ahead Log). A cursor sorts the `(time, value)` tuples by time in ascending or descending order.
For example, a query that evaluates one field for 1,000 series over 3 shards constructs a minimum of 3,000 cursors (1,000 per shard).
### Auxiliary fields
Because InfluxQL allows users to use selector functions such as `FIRST()`,
`LAST()`, `MIN()`, and `MAX()`, the engine must provide a way to return related
data at the same time with the selected point.
Let's look at the following query:
```sql
SELECT FIRST(value), host FROM cpu GROUP BY time(1h)
```
We are selecting the first `value` that occurs every hour but we also want to
retrieve the `host` associated with that point. Since the `Point` types only
specify a single typed `Value` for efficiency, we push the `host` into the
auxiliary fields of the point. These auxiliary fields are attached to the point
until it is passed to the emitter where the fields get split off to their own
iterator.
### Built-in iterators
There are many helper iterators that let us build queries:
* Merge Iterator - This iterator combines one or more iterators into a single
new iterator of the same type. This iterator guarantees that all points
within a window will be output before starting the next window, but does not
provide ordering guarantees within the window. This allows for fast access
for aggregate queries that don't need stronger sorting guarantees.
* Sorted Merge Iterator - Like `MergeIterator`, this iterator combines one or more iterators
into a new iterator of the same type. However, this iterator guarantees
time ordering of every point. This makes it slower than the `MergeIterator`
but this ordering guarantee is required for non-aggregate queries which
return the raw data points.
* Limit Iterator - This iterator limits the number of points per name or tag
group. This is the implementation of the `LIMIT` & `OFFSET` syntax.
* Fill Iterator - This iterator injects extra points if they are missing from
the input iterator. It can provide `null` points, points with the previous
value, or points with a specific value.
* Buffered Iterator - This iterator provides the ability to "unread" a point
back onto a buffer so it can be read again next time. This is used extensively
to provide lookahead for windowing.
* Reduce Iterator - This iterator calls a reduction function for each point in
a window. When the window is complete, then all points for that window are
output. This is used for simple aggregate functions such as `COUNT()`.
* Reduce Slice Iterator - This iterator collects all points for a window first,
and then passes them all to a reduction function at once. The results are
returned from the iterator. This is used for aggregate functions such as
`DERIVATIVE()`.
* Transform Iterator - This iterator calls a transform function for each point
from an input iterator. This is used for executing binary expressions.
* Dedupe Iterator - This iterator only outputs unique points. Because it is resource-intensive, this iterator is only used for small queries such as meta query statements.
### Call iterators
Function calls in InfluxQL are implemented at two levels:
- Some calls can be
wrapped at multiple layers to improve efficiency. For example, a `COUNT()` can
be performed at the shard level and then multiple `CountIterator`s can be
wrapped with another `CountIterator` to compute the count of all shards. These
iterators can be created using `NewCallIterator()`.
- Some iterators are more complex or need to be implemented at a higher level.
For example, the `DERIVATIVE()` function needs to retrieve all points for a window
before performing the calculation. This iterator is created by the engine itself
and is never requested to be created by the lower levels.

View File

@ -0,0 +1,261 @@
---
title: LIMIT and SLIMIT clauses
description: >
Use `LIMIT` to limit the number of **rows** returned per InfluxQL group.
Use `SLIMIT` to limit the number of [series](/influxdb/cloud-dedicated/reference/glossary/#series)
returned in query results.
menu:
influxdb_cloud_dedicated:
name: LIMIT and SLIMIT clauses
parent: influxql-reference
weight: 206
list_code_example: |
```sql
SELECT_clause FROM_clause [WHERE_clause] [GROUP_BY_clause] [ORDER_BY_clause] LIMIT row_N SLIMIT series_N
```
---
Use `LIMIT` to limit the number of **rows** returned per InfluxQL group.
Use `SLIMIT` to limit the number of [series](/influxdb/cloud-dedicated/reference/glossary/#series)
returned in query results.
- [LIMIT clause](#limit-clause)
- [Syntax](#limit-syntax)
- [Examples](#limit-examples)
- [SLIMIT clause](#slimit-clause)
<!-- - [Syntax](#slimit-syntax) -->
<!-- - [Examples](#slimit-examples) -->
<!-- - [Use LIMIT and SLIMIT together](#use-limit-and-slimit-together) -->
<!-- - [Syntax](#limit-slimit-syntax) -->
<!-- - [Examples](#limit-slimit-examples) -->
## LIMIT clause
The `LIMIT` clause limits the number of rows to return from each InfluxQL group.
If the query doesn't include a [`GROUP BY` clause](/influxdb/cloud-dedicated/reference/influxql/group-by/),
the entire result set is considered a single group.
If a query [groups data by time](/influxdb/cloud-dedicated/reference/influxql/group-by/#group-by-time),
limits are applied after aggregate and selector operations are applied to each
time window.
### Syntax {#limit-syntax}
```sql
SELECT_clause FROM_clause [WHERE_clause] [GROUP_BY_clause] [ORDER_BY_clause] LIMIT N
```
#### Arguments
- **N**: Maximum number of points to return from each InfluxQL group.
If `N` is greater than the number of points in a group,
all points from the group are returned.
### Examples {#limit-examples}
The following examples use the
[Get started home sensor sample data](/influxdb/cloud-dedicated/reference/sample-data/#get-started-home-sensor-data).
{{< expand-wrapper >}}
{{% expand "Limit the number of rows returned" %}}
```sql
SELECT * FROM home LIMIT 3
```
{{% influxql/table-meta %}}
Name: home
{{% /influxql/table-meta %}}
{{% influxdb/custom-timestamps %}}
| time | co | hum | room | temp |
| :------------------- | --: | ---: | :---------- | ---: |
| 2022-01-01T08:00:00Z | 0 | 35.9 | Kitchen | 21 |
| 2022-01-01T08:00:00Z | 0 | 35.9 | Living Room | 21.1 |
| 2022-01-01T09:00:00Z | 0 | 36.2 | Kitchen | 23 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{% expand "Limit the number of rows returned from each InfluxQL group" %}}
```sql
SELECT
MEAN(*)
FROM home
GROUP BY
time(2h),
room
LIMIT 3
```
{{% influxdb/custom-timestamps %}}
{{% influxql/table-meta %}}
name: home
tags: room=Kitchen
{{% /influxql/table-meta %}}
| time | mean_co | mean_hum | mean_temp |
| :------------------- | ------: | -------: | -----------------: |
| 2022-01-01T08:00:00Z | 0 | 36.05 | 22 |
| 2022-01-01T10:00:00Z | 0 | 36.05 | 22.549999999999997 |
| 2022-01-01T12:00:00Z | 0.5 | 36.25 | 22.65 |
{{% influxql/table-meta %}}
name: home
tags: room=Living Room
{{% /influxql/table-meta %}}
| time | mean_co | mean_hum | mean_temp |
| :------------------- | ------: | -------: | -----------------: |
| 2022-01-01T08:00:00Z | 0 | 35.9 | 21.25 |
| 2022-01-01T10:00:00Z | 0 | 36 | 22 |
| 2022-01-01T12:00:00Z | 0 | 35.95 | 22.299999999999997 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{< /expand-wrapper >}}
## SLIMIT clause
{{% warn %}}
InfluxQL is being rearchitected to work with the InfluxDB IOx storage engine.
This process is ongoing and some InfluxQL features, such as `SLIMIT` are still
being implemented. For more information, see
[InfluxQL feature support](/influxdb/cloud-dedicated/reference/influxql/feature-support/).
{{% /warn %}}
<!-- The `SLIMIT` clause limits the number of [series](/influxdb/cloud-dedicated/reference/glossary/#series)
to return in query results.
{{% note %}}
For meaningful results, queries that include the `SLIMIT` clause should also
include the [`GROUP BY` clause](/influxdb/cloud-dedicated/reference/influxql/group-by/) that
[groups by tags](/influxdb/cloud-dedicated/reference/influxql/group-by/#group-by-tags-examples).
Without grouping data by tags, all results are treated as a single series and
`SLIMIT` returns the full queried result set.
{{% /note %}}
### Syntax {#slimit-syntax}
```sql
SELECT_clause FROM_clause [WHERE_clause] [GROUP_BY_clause] [ORDER_BY_clause] [LIMIT_clause] SLIMIT N
```
If the query includes a [`LIMIT` clause](#limit-clause), the `SLIMIT` clause
must come **after** the `LIMIT` clause.
See [Use LIMIT and SLIMIT together](#use-limit-and-slimit-together).
#### Arguments
- **N**: Maximum number of series to return in query results.
If `N` is greater than the number of series in a measurement, the query
returns all series.
### Examples {#slimit-examples}
{{< expand-wrapper >}}
{{% expand "Limit the number of series returned" %}}
The following example uses the
[Bitcoin price sample data](/influxdb/cloud-dedicated/reference/sample-data/#bitcoin-price-data).
```sql
SELECT * FROM bitcoin GROUP BY * SLIMIT 2
```
{{% influxql/table-meta %}}
name: bitcoin
tags: code=EUR, crypto=bitcoin, description=Euro, symbol=&euro;
{{% /influxql/table-meta %}}
| time | price |
| :------------------- | ---------: |
| 2023-05-01T00:19:00Z | 28561.8722 |
| 2023-05-01T00:48:00Z | 28549.727 |
| 2023-05-01T01:31:00Z | 28506.7155 |
| 2023-05-01T02:07:00Z | 27861.4404 |
| 2023-05-01T02:26:00Z | 27864.0643 |
| ... | ... |
{{% influxql/table-meta %}}
name: bitcoin
tags: code=GBP, crypto=bitcoin, description=British Pound Sterling, symbol=&pound;
{{% /influxql/table-meta %}}
| time | price |
| :------------------- | ---------: |
| 2023-05-01T00:19:00Z | 24499.4816 |
| 2023-05-01T00:48:00Z | 24489.0637 |
| 2023-05-01T01:31:00Z | 24452.1698 |
| 2023-05-01T02:07:00Z | 23898.673 |
| 2023-05-01T02:26:00Z | 23900.9237 |
| ... | ... |
{{% /expand %}}
{{< /expand-wrapper >}}
## Use LIMIT and SLIMIT together
Using the `LIMIT` clause and the `SLIMIT` clause together returns the specified
maximum number of rows from the specified maximum number of series in query results.
### Syntax {#limit-slimit-syntax}
```sql
SELECT_clause FROM_clause [WHERE_clause] [GROUP_BY_clause] [ORDER_BY_clause] LIMIT row_N SLIMIT series_N
```
In queries that include both the `LIMIT` clause and the `SLIMIT` clause,
the `LIMIT` clause must come **first**.
#### Arguments
- **row_N**: Maximum number of points to return from each InfluxQL group.
If `row_N` is greater than the number of points in a group,
all points from the group are returned.
- **series_N**: Maximum number of series to return in query results.
If `series_N` is greater than the number of series in a measurement, the query
returns all series.
### Examples {#limit-slimit-examples}
{{< expand-wrapper >}}
{{% expand "Limit the number of rows and series returned" %}}
The following example uses the
[Bitcoin price sample data](/influxdb/cloud-dedicated/reference/sample-data/#bitcoin-price-data).
```sql
SELECT * FROM bitcoin GROUP BY * LIMIT 3 SLIMIT 2
```
{{% influxql/table-meta %}}
name: bitcoin
tags: code=EUR, crypto=bitcoin, description=Euro, symbol=&euro;
{{% /influxql/table-meta %}}
| time | price |
| :------------------- | ---------: |
| 2023-05-01T00:19:00Z | 28561.8722 |
| 2023-05-01T00:48:00Z | 28549.727 |
| 2023-05-01T01:31:00Z | 28506.7155 |
{{% influxql/table-meta %}}
name: bitcoin
tags: code=GBP, crypto=bitcoin, description=British Pound Sterling, symbol=&pound;
{{% /influxql/table-meta %}}
| time | price |
| :------------------- | ---------: |
| 2023-05-01T00:19:00Z | 24499.4816 |
| 2023-05-01T00:48:00Z | 24489.0637 |
| 2023-05-01T01:31:00Z | 24452.1698 |
{{% /expand %}}
{{< /expand-wrapper >}} -->

View File

@ -0,0 +1,249 @@
---
title: OFFSET and SOFFSET clauses
description: >
Use `OFFSET` to specify the number of [rows](/influxdb/cloud-dedicated/reference/glossary/#series)
to skip in each InfluxQL group before returning results.
Use `SOFFSET` to specify the number of [series](/influxdb/cloud-dedicated/reference/glossary/#series)
to skip before returning results.
menu:
influxdb_cloud_dedicated:
name: OFFSET and SOFFSET clauses
parent: influxql-reference
weight: 207
list_code_example: |
```sql
SELECT_clause FROM_clause [WHERE_clause] [GROUP_BY_clause] [ORDER_BY_clause] [LIMIT_clause] OFFSET row_N [SLIMIT_clause] SOFFSET series_N
```
---
Use `OFFSET` to specify the number of [rows](/influxdb/cloud-dedicated/reference/glossary/#series)
to skip in each InfluxQL group before returning results.
Use `SOFFSET` to specify the number of [series](/influxdb/cloud-dedicated/reference/glossary/#series)
to skip before returning results.
- [OFFSET clause](#offset-clause)
- [Syntax](#offset-syntax)
- [Notable OFFSET clause behaviors](#notable-offset-clause-behaviors)
- [Examples](#offset-examples)
- [SOFFSET clause](#soffset-clause)
<!-- - [Syntax](#soffset-syntax) -->
<!-- - [Notable SOFFSET clause behaviors](#notable-soffset-clause-behaviors) -->
<!-- - [Examples](#soffset-examples) -->
## `OFFSET` clause
The `OFFSET` clause skips `N` rows in each InfluxQL group before returning results.
Offsets honor row limits specified in the
[`LIMIT` clause](/influxdb/cloud-dedicated/reference/influxql/limit-and-slimit/#limit-clause)
and display the limited number of rows after the specified offset.
Use `LIMIT` and `OFFSET` together to paginate query results.
### Syntax {#offset-syntax}
```sql
SELECT_clause FROM_clause [WHERE_clause] [GROUP_BY_clause] [ORDER_BY_clause] [LIMIT_clause] OFFSET N [SLIMIT_clause] [SOFFSET_clause]
```
#### Arguments
- **N**: Number of rows to skip in each InfluxQL group before returning results.
### Notable OFFSET clause behaviors
- If there is no `LIMIT` clause in a query with an `OFFSET` clause, the query
returns a single row per InfluxQL group at the specified offset.
- If the query doesn't include a [`GROUP BY` clause](/influxdb/cloud-dedicated/reference/influxql/group-by/),
the entire result set is considered a single group and is returned in full.
- If a query [groups data by time](/influxdb/cloud-dedicated/reference/influxql/group-by/#group-by-time),
the offset is applied after aggregate and selector operations are applied to each
time window.
- If the [`WHERE` clause](/influxdb/cloud-dedicated/reference/influxql/where/)
includes a time range and the `OFFSET` clause causes InfluxQL to return points
with timestamps outside of that time range, InfluxQL returns no results.
### Examples {#offset-examples}
The following examples use the
[Get started home sensor sample data](/influxdb/cloud-dedicated/reference/sample-data/#get-started-home-sensor-data).
{{< expand-wrapper >}}
{{% expand "Return the nth row" %}}
```sql
SELECT * FROM home OFFSET 3
```
{{% influxql/table-meta %}}
Name: home
{{% /influxql/table-meta %}}
{{% influxdb/custom-timestamps %}}
| time | co | hum | room | temp |
| :------------------- | --: | ---: | :---------- | ---: |
| 2022-01-01T09:00:00Z | 0 | 35.9 | Living Room | 21.4 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{% expand "Paginate results by 3 and return the 2nd page of results" %}}
```sql
SELECT * FROM home WHERE room = 'Kitchen' LIMIT 3 OFFSET 3
```
{{% influxql/table-meta %}}
Name: home
{{% /influxql/table-meta %}}
{{% influxdb/custom-timestamps %}}
| time | co | hum | room | temp |
| :------------------- | --: | ---: | :------ | ---: |
| 2022-01-01T11:00:00Z | 0 | 36 | Kitchen | 22.4 |
| 2022-01-01T12:00:00Z | 0 | 36 | Kitchen | 22.5 |
| 2022-01-01T13:00:00Z | 1 | 36.5 | Kitchen | 22.8 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{% expand "Paginate results from each series by 3 and return the 2nd page of each series" %}}
```sql
SELECT * FROM home GROUP BY * LIMIT 3 OFFSET 3
```
{{% influxdb/custom-timestamps %}}
{{% influxql/table-meta %}}
name: home
tags: room=Kitchen
{{% /influxql/table-meta %}}
| time | co | hum | temp |
| :------------------- | --: | ---: | ---: |
| 2022-01-01T11:00:00Z | 0 | 36 | 22.4 |
| 2022-01-01T12:00:00Z | 0 | 36 | 22.5 |
| 2022-01-01T13:00:00Z | 1 | 36.5 | 22.8 |
{{% influxql/table-meta %}}
name: home
tags: room=Living Room
{{% /influxql/table-meta %}}
| time | co | hum | temp |
| :------------------- | --: | ---: | ---: |
| 2022-01-01T11:00:00Z | 0 | 36 | 22.2 |
| 2022-01-01T12:00:00Z | 0 | 35.9 | 22.2 |
| 2022-01-01T13:00:00Z | 0 | 36 | 22.4 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{< /expand-wrapper >}}
## `SOFFSET` clause
{{% warn %}}
InfluxQL is being rearchitected to work with the InfluxDB IOx storage engine.
This process is ongoing and some InfluxQL features, such as `SOFFSET` are still
being implemented. For more information, see
[InfluxQL feature support](/influxdb/cloud-dedicated/reference/influxql/feature-support/).
{{% /warn %}}
<!-- The `SOFFSET` clause skips `N` [series](/influxdb/cloud-dedicated/reference/glossary/#series)
before returning results.
Offsets honor series limits specified in the
[`SLIMIT` clause](/influxdb/cloud-dedicated/reference/influxql/limit-and-slimit/#slimit-clause)
and display the limited number of series after the specified offset.
Use `SLIMIT` and `SOFFSET` together to paginate grouped query results.
The `SOFFSET` clause requires these other clauses:
- [`SLIMIT` clause](/influxdb/cloud-dedicated/reference/influxql/limit-and-slimit/#slimit-clause)
- [`GROUP BY` clause](/influxdb/cloud-dedicated/reference/influxql/group-by/) that
[groups by tags](/influxdb/cloud-dedicated/reference/influxql/group-by/#group-by-tags-examples)
### Syntax {#soffset-syntax}
```sql
SELECT_clause FROM_clause [WHERE_clause] GROUP_BY_clause [ORDER_BY_clause] [LIMIT_clause] [OFFSET_clause] SLIMIT_clause SOFFSET N
```
#### Arguments
- **N**: Number of [series](/influxdb/cloud-dedicated/reference/glossary/#series)
to skip before returning results.
{{% note %}}
**Note:**
{{% /note %}}
### Notable SOFFSET clause behaviors
- If there is no `SLIMIT` clause in a query with an `SOFFSET` clause, the query
returns no results.
- If the query doesn't include a [`GROUP BY` clause](/influxdb/cloud-dedicated/reference/influxql/group-by/),
the query returns no results.
- If the `SOFFSET` clause skips more than the total number of series, the query
returns no results.
### Examples {#soffset-examples}
The following examples use the
[Bitcoin price sample data](/influxdb/cloud-dedicated/reference/sample-data/#bitcoin-price-data).
{{< expand-wrapper >}}
{{% expand "Return the 2nd series" %}}
```sql
SELECT * FROM bitcoin GROUP BY * SLIMIT 1 SOFFSET 1
```
{{% influxql/table-meta %}}
name: bitcoin
tags: code=GBP, crypto=bitcoin, description=British Pound Sterling, symbol=&pound;
{{% /influxql/table-meta %}}
| time | price |
| :------------------- | ---------: |
| 2023-05-01T00:19:00Z | 24499.4816 |
| 2023-05-01T00:48:00Z | 24489.0637 |
| 2023-05-01T01:31:00Z | 24452.1698 |
| 2023-05-01T02:07:00Z | 23898.673 |
| 2023-05-01T02:26:00Z | 23900.9237 |
| ... | ... |
{{% /expand %}}
{{% expand "Paginate series by 2 and return the 2nd page of results" %}}
```sql
SELECT * FROM bitcoin GROUP BY * 2 SOFFSET 2
```
{{% note %}}
Because the **Bitcoin price sample data** contains only 3 series, when paginating
by 2, the 2nd "page" contains only one series.
{{% /note %}}
{{% influxql/table-meta %}}
name: bitcoin
tags: code=USD, crypto=bitcoin, description=United States Dollar, symbol=&#36;
{{% /influxql/table-meta %}}
| time | price |
| :------------------- | ---------: |
| 2023-05-01T00:19:00Z | 29319.9092 |
| 2023-05-01T00:48:00Z | 29307.4416 |
| 2023-05-01T01:31:00Z | 29263.2886 |
| 2023-05-01T02:07:00Z | 28600.8878 |
| 2023-05-01T02:26:00Z | 28603.5813 |
| ... | ... |
{{% /expand %}}
{{< /expand-wrapper >}} -->

View File

@ -0,0 +1,109 @@
---
title: ORDER BY clause
list_title: ORDER BY clause
description: >
Use the `ORDER BY` clause to sort data by time in ascending or descending order.
menu:
influxdb_cloud_dedicated:
name: ORDER BY clause
identifier: influxql-order-by
parent: influxql-reference
weight: 204
list_code_example: |
```sql
SELECT_clause FROM_clause [WHERE_clause] [GROUP_BY_clause] ORDER BY time [DESC|ASC]
```
---
Use the `ORDER BY` clause to sort data by time in ascending or descending order.
InfluxQL only supports sorting data by `time`.
- [Syntax](#syntax)
- [Examples](#examples)
## Syntax
```sql
SELECT_clause FROM_clause [WHERE_clause] [GROUP_BY_clause] ORDER BY time [ASC|DESC]
```
- If the the `ORDER BY` clause is not included, the default behavior is to sort data by
time in **ascending** order: `ORDER BY time ASC`.
- If the query includes [`WHERE`](/influxdb/cloud-dedicated/reference/influxql/where/)
and [`GROUP BY`](/influxdb/cloud-dedicated/reference/influxql/group-by/) clauses,
the `ORDER BY` clause must come **after** these clauses.
#### Sort orders
- **ASC (ascending)**: The first row in the results has the oldest timestamp.
The last row in the results has the most recent timestamp.
- **DESC (descending)**: The first row in the results has the most recent timestamp.
The last row in the results has the oldest timestamp.
## Examples
The following examples use the
[Get started home sensor sample data](/influxdb/cloud-dedicated/reference/sample-data/#get-started-home-sensor-data).
{{< expand-wrapper >}}
{{% expand "Sort data with the oldest points first" %}}
{{% note %}}
Ordering data by time in ascending order is the default behavior.
Including `ORDER BY time ASC` in the query isn't necessary, but it is supported.
{{% /note %}}
{{% influxdb/custom-timestamps %}}
```sql
SELECT *
FROM home
WHERE
room = 'Kitchen'
AND time >= '2022-01-01T08:00:00Z'
AND time <= '2022-01-01T12:00:00Z'
ORDER BY time ASC
```
{{% influxql/table-meta %}}
Name: home
{{% /influxql/table-meta %}}
| time | co | hum | room | temp |
| :------------------- | --: | ---: | :------ | ---: |
| 2022-01-01T08:00:00Z | 0 | 35.9 | Kitchen | 21 |
| 2022-01-01T09:00:00Z | 0 | 36.2 | Kitchen | 23 |
| 2022-01-01T10:00:00Z | 0 | 36.1 | Kitchen | 22.7 |
| 2022-01-01T11:00:00Z | 0 | 36 | Kitchen | 22.4 |
| 2022-01-01T12:00:00Z | 0 | 36 | Kitchen | 22.5 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{% expand "Sort data with the newest points first" %}}
{{% influxdb/custom-timestamps %}}
```sql
SELECT *
FROM home
WHERE
room = 'Kitchen'
AND time >= '2022-01-01T08:00:00Z'
AND time <= '2022-01-01T12:00:00Z'
ORDER BY time DESC
```
| time | co | hum | room | temp |
| :------------------- | --: | ---: | :------ | ---: |
| 2022-01-01T12:00:00Z | 0 | 36 | Kitchen | 22.5 |
| 2022-01-01T11:00:00Z | 0 | 36 | Kitchen | 22.4 |
| 2022-01-01T10:00:00Z | 0 | 36.1 | Kitchen | 22.7 |
| 2022-01-01T09:00:00Z | 0 | 36.2 | Kitchen | 23 |
| 2022-01-01T08:00:00Z | 0 | 35.9 | Kitchen | 21 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -0,0 +1,63 @@
---
title: Quotation
description: >
Single quotation marks (`'`) are used in the string literal syntax.
Double quotation marks (`"`) are used to quote identifiers.
menu:
influxdb_cloud_dedicated:
name: Quotation
identifier: influxql-quotation
parent: influxql-reference
weight: 214
list_code_example: |
```sql
-- String literal
'I am a string'
-- Quoted identifier
"this-is-an-identifier"
```
---
InfluxQL supports both single and double quotation marks, but they each function
differently and serve different purposes.
- [Single quotes](#single-quotes)
- [Double quotes](#double-quotes)
## Single quotes
Use single quotation marks (`'`) in the
[string literal](/influxdb/cloud-dedicated/reference/influxql/#strings) and
[timestamp literal](/influxdb/cloud-dedicated/reference/influxql/#dates--times) syntax.
In the following example, the `WHERE` clause evaluates the value of the `room` tag.
Tags only contain string values, so the right operand of the predicate expression
should be a string literal.
```sql
... WHERE room = 'Kitchen'
```
## Double quotes
Use double quotation marks (`"`) to quote [identifiers](/influxdb/cloud-dedicated/reference/influxql/#identifiers).
Identifiers **must** be double-quoted in the following cases:
- The identifier contains non-word characters.
Word characters are defined as `[a-z,A-Z,0-9,_]`.
- The identifier contains [InfluxQL keywords](/influxdb/cloud-dedicated/reference/influxql/#keywords).
- The identifier begins with a digit.
Double-quoted identifiers can also:
- Contain any Unicode character except for a new line.
- Contain escaped `"` characters (for example: `\"`).
- Include [InfluxQL keywords](/influxdb/cloud-dedicated/reference/influxql/#keywords).
**While not always necessary, we recommend that you double quote identifiers.**
{{% note %}}
InfluxQL quoting guidelines differ from
[line protocol quoting guidelines](/influxdb/cloud-dedicated/reference/syntax/line-protocol/#quotes).
{{% /note %}}

View File

@ -0,0 +1,210 @@
---
title: Regular expressions
list_title: Regular expressions
description: >
Use `regular expressions` to match patterns in your data.
menu:
influxdb_cloud_dedicated:
name: Regular expressions
identifier: influxql-regular-expressions
parent: influxql-reference
weight: 213
list_code_example: |
```sql
SELECT /<regular_expression_field_key>/ FROM /<regular_expression_measurement>/ WHERE [<tag_key> <operator> /<regular_expression_tag_value>/ | <field_key> <operator> /<regular_expression_field_value>/] GROUP BY /<regular_expression_tag_key>/
```
---
Regular expressions are a sequence of characters used to identify patterns in
identifiers and string values.
InfluxQL supports regular expressions in the following operations:
- Identifying **fields** and **tags** to query in the
[`SELECT` clause](/influxdb/cloud-dedicated/reference/influxql/select/).
- Identifying **measurements** to query in the
[`FROM` clause](/influxdb/cloud-dedicated/reference/influxql/select/#from-clause).
- Testing **tag values** and **string field values** in the
[`WHERE` clause](/influxdb/cloud-dedicated/reference/influxql/where/).
- Identifying **tag keys** to group by in the
[`GROUP BY` clause](/influxdb/cloud-dedicated/reference/influxql/group-by/)
{{% note %}}
#### Query performance
Regular expression comparisons are more computationally intensive than exact
string comparisons. Queries with regular expressions are not as performant
as those without.
{{% /note %}}
## Regular expression syntax
InfluxQL Regular expressions are surrounded by `/` characters and use the
[Go regular expression syntax](http://golang.org/pkg/regexp/syntax/).
```sql
/regular_expression/
```
### Regular expression flags
Regular expression flags modify the pattern-matching behavior of the expression.
InfluxQL supports the following regular expression flags:
| Flag | Description |
| :--- | :------------------------------------------------------------------------------ |
| i | case-insensitive |
| m | multi-line mode: `^` and `$` match begin/end line in addition to begin/end text |
| s | let `.` match `\n` |
| U | ungreedy: swap meaning of `x*` and `x*?`, `x+` and `x+?`, etc. |
Include regular expression flags at the beginning of your regular expression
pattern enclosed in parentheses (`()`) and preceded by a question mark (`?`).
```sql
/(?iU)foo*/
```
## Regular expression operators
InfluxQL provides the following regular expression operators that test if a
string operand matches a regular expression:
- `=~`: Returns true if the string matches the regular expression
- `!~`: Returns true if the string does not match the regular expression
InfluxQL regular expression operators are used to test string column values in
the [`WHERE` clause](/influxdb/cloud-dedicated/reference/influxql/where/).
## Regular expression examples
The examples below use the following sample data sets:
- [NOAA Bay Area weather data](/influxdb/cloud-dedicated/reference/sample-data/#noaa-bay-area-weather-data)
- [Get started home sensor data](/influxdb/cloud-dedicated/reference/sample-data/#get-started-home-sensor-data)
{{< expand-wrapper >}}
{{% expand "Use a regular expression to specify field keys and tag keys in the SELECT clause" %}}
```sql
SELECT /^t/ FROM weather
```
{{% influxql/table-meta %}}
name: weather
{{% /influxql/table-meta %}}
| time | temp_avg | temp_max | temp_min |
| :------------------- | -------: | -------: | -------: |
| 2020-01-01T00:00:00Z | 52 | 66 | 44 |
| 2020-01-01T00:00:00Z | 53 | 59 | 47 |
| 2020-01-01T00:00:00Z | 50 | 57 | 44 |
| 2020-01-02T00:00:00Z | 54 | 61 | 49 |
| 2020-01-02T00:00:00Z | 51 | 60 | 44 |
| 2020-01-02T00:00:00Z | 53 | 66 | 42 |
| ... | ... | ... | ... |
{{% /expand %}}
{{% expand "Use a regular expression to specify measurements in the FROM clause" %}}
```sql
SELECT /^t/ FROM /^[hw]/
```
{{% influxql/table-meta %}}
name: weather
{{% /influxql/table-meta %}}
| time | temp | temp_avg | temp_max | temp_min |
| :------------------- | ---: | -------: | -------: | -------: |
| 2020-01-01T00:00:00Z | | 52 | 66 | 44 |
| 2020-01-01T00:00:00Z | | 53 | 59 | 47 |
| 2020-01-01T00:00:00Z | | 50 | 57 | 44 |
| 2020-01-02T00:00:00Z | | 54 | 61 | 49 |
| 2020-01-02T00:00:00Z | | 51 | 60 | 44 |
| 2020-01-02T00:00:00Z | | 53 | 66 | 42 |
| ... | ... | ... | ... | ... |
{{% /expand %}}
{{% expand "Use a regular expression to specify tag values in the WHERE clause" %}}
```sql
SELECT * FROM weather WHERE location !~ /^[S]/
```
{{% influxql/table-meta %}}
name: weather
{{% /influxql/table-meta %}}
| time | location | precip | temp_avg | temp_max | temp_min | wind_avg |
| :------------------- | :------- | -----: | -------: | -------: | -------: | -------: |
| 2020-01-01T00:00:00Z | Concord | 0 | 52 | 66 | 44 | 3.13 |
| 2020-01-01T00:00:00Z | Hayward | 0 | 50 | 57 | 44 | 2.24 |
| 2020-01-02T00:00:00Z | Concord | 0 | 53 | 66 | 42 | 3.13 |
| 2020-01-02T00:00:00Z | Hayward | 0 | 51 | 60 | 44 | 3.8 |
| 2020-01-03T00:00:00Z | Concord | 0 | 49 | 60 | 38 | 2.68 |
| 2020-01-03T00:00:00Z | Hayward | 0 | 50 | 62 | 41 | 3.13 |
| ... | ... | ... | ... | ... | ... | ... |
{{% /expand %}}
{{% expand "Use a regular expression to specify a tag with no value in the WHERE clause" %}}
```sql
SELECT * FROM home, weather WHERE location !~ /./
```
{{% influxql/table-meta %}}
name: weather
{{% /influxql/table-meta %}}
| time | co | hum | location | precip | room | temp | temp_avg | temp_max | temp_min | wind_avg |
| :------------------- | --: | ---: | -------- | ------ | :---------- | ---: | -------- | -------- | -------- | -------- |
| 2022-01-01T08:00:00Z | 0 | 35.9 | | | Kitchen | 21 | | | | |
| 2022-01-01T08:00:00Z | 0 | 35.9 | | | Living Room | 21.1 | | | | |
| 2022-01-01T09:00:00Z | 0 | 36.2 | | | Kitchen | 23 | | | | |
| 2022-01-01T09:00:00Z | 0 | 35.9 | | | Living Room | 21.4 | | | | |
| 2022-01-01T10:00:00Z | 0 | 36.1 | | | Kitchen | 22.7 | | | | |
| 2022-01-01T10:00:00Z | 0 | 36 | | | Living Room | 21.8 | | | | |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
{{% /expand %}}
{{% expand "Use a regular expression to specify tag keys in the GROUP BY clause" %}}
```sql
SELECT MAX(precip) FROM weather GROUP BY /^l/
```
{{% influxql/table-meta %}}
name: weather
tags: location=Concord
{{% /influxql/table-meta %}}
| time | max |
| :------------------- | ---: |
| 2021-10-24T00:00:00Z | 4.53 |
{{% influxql/table-meta %}}
name: weather
tags: location=Hayward
{{% /influxql/table-meta %}}
| time | max |
| :------------------- | ---: |
| 2022-12-31T00:00:00Z | 4.34 |
{{% influxql/table-meta %}}
name: weather
tags: location=San Francisco
{{% /influxql/table-meta %}}
| time | max |
| :------------------- | ---: |
| 2021-10-24T00:00:00Z | 4.02 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -0,0 +1,449 @@
---
title: SELECT statement
list_title: SELECT statement
description: >
Use the `SELECT` statement to query data from one or more
[measurements](/influxdb/cloud-dedicated/reference/glossary/#measurement).
menu:
influxdb_cloud_dedicated:
name: SELECT statement
identifier: influxql-select-statement
parent: influxql-reference
weight: 201
list_code_example: |
```sql
SELECT <field_key>[,<field_key>,<tag_key>] FROM <measurement_name>[,<measurement_name>]
```
---
Use the `SELECT` statement to query data from one or more
[measurements](/influxdb/cloud-dedicated/reference/glossary/#measurement).
The `SELECT` statement **requires** a [`SELECT` clause](#select-clause) and a
[`FROM` clause](#from-clause).
- [Syntax](#syntax)
- [SELECT clause](#select-clause)
- [FROM clause](#from-clause)
- [Notable SELECT statement behaviors](#notable-select-statement-behaviors)
- [Data types and casting operations](#data-types-and-casting-operations)
- [SELECT statement examples](#select-statement-examples)
<!-- - [Multiple statements](#multiple-statements) -->
## Syntax
```sql
SELECT field_expression[, ..., field_expression_n[, tag_expression[, ..., tag_expression_n]]] FROM measurement_expression[, ..., measurement_expression_n]
```
### SELECT clause
The `SELECT` clause supports several formats for identifying data to query.
It requires one or more **field expressions** and optional **tag expressions**.
- **field_expression**: Expression to identify one or more fields to return in query results.
Can be a [field key](/influxdb/cloud-dedicated/reference/glossary/#field-key),
constant, [regular expression](/influxdb/cloud-dedicated/reference/influxql/regular-expressions/),
[wildcard (`*`)](#wildcard-expressions-in-select-clauses), or
[function](/influxdb/cloud-dedicated/reference/influxql/functions/) and any
combination of arithmetic operators.
- **tag_expression**: Expression to identify one or more tags to return in query results.
Can be a [tag key](/influxdb/cloud-dedicated/reference/glossary/#tag-key) or constant.
#### Select clause behaviors
- `SELECT field_key` - Returns a specific field.
- `SELECT field_key1, field_key2` - Returns two specific fields.
- `SELECT field_key, tag_key` - Returns a specific field and tag.
- `SELECT *` - Returns all [fields](/influxdb/cloud-dedicated/reference/glossary/#field)
and [tags](/influxdb/cloud-dedicated/reference/glossary/#tag).
_See [Wildcard expressions](#wildcard-expressions)._
- `SELECT /^[t]/` - Returns all [fields](/influxdb/cloud-dedicated/reference/glossary/#field)
and [tags](/influxdb/cloud-dedicated/reference/glossary/#tag) with keys that
match the regular expression. At least one field key must match the regular
expression. If no field keys match the regular expression, no results are
returned.
### FROM clause
The `FROM` clause specifies the
[measurement](/influxdb/cloud-dedicated/reference/glossary/#measurement) to query.
It requires one or more comma-delimited **measurement expressions**.
- **measurement_expression**: Expression to identify one or more measurements to query.
Can be a measurement name, fully-qualified measurement, constant, or
[regular expression](/influxdb/cloud-dedicated/reference/influxql/regular-expressions/).
- ##### Measurement name
```sql
FROM measurement
```
- ##### Fully-qualified measurement
```sql
FROM database.retention_policy.measurement
-- Fully-qualified measurement with default retention policy
FROM database..measurement
```
{{% note %}}
#### InfluxDB retention policies
In {{< cloud-name >}}, **retention policies** are not part of the data model like
they are in InfluxDB 1.x.
Each {{< cloud-name >}} database has a **retention period** which defines the
maximum age of data to retain in the database. To use fully-qualified
measurements in InfluxQL queries, use the following naming convention when
[creating a database](/influxdb/cloud-dedicated/admin/databases/create/):
```
database_name/retention_policy
```
{{% /note %}}
## Notable SELECT statement behaviors
- [Must query at least one field](#must-query-at-least-one-field)
- [Wildcard expressions](#wildcard-expressions)
- [Cannot include both aggregate and non-aggregate field expressions](#cannot-include-both-aggregate-and-non-aggregate-field-expressions)
### Must query at least one field
A query requires at least one [field key](/influxdb/cloud-dedicated/reference/glossary/#field-key)
in the `SELECT` clause to return data.
If the `SELECT` clause includes only [tag keys](/influxdb/cloud-dedicated/reference/glossary/#tag-key),
the query returns an empty result.
When using regular expressions in the `SELECT` clause, if regular expression
matches only tag keys and no field keys, the query returns an empty result.
To return data associated with tag keys, include at least one field key in the
`SELECT` clause.
### Wildcard expressions
When using a wildcard expression (`*`) in the `SELECT` clause, the query returns
all tags and fields.
If a [function](/influxdb/cloud-dedicated/reference/influxql/functions/) is
applied to a wildcard expression, the query returns all _fields_ with
the function applied, but does not return _tags_ unless they are included in
the `SELECT` clause.
### Cannot include both aggregate and non-aggregate field expressions
The `SELECT` statement cannot include an aggregate field expression
(one that uses an [aggregate](/influxdb/cloud-dedicated/reference/influxql/functions/aggregates/)
or [selector](/influxdb/cloud-dedicated/reference/influxql/functions/aggregates/)
function) **and** a non-aggregate field expression.
For example, in the following query, an aggregate function is applied to one
field, but not the other:
```sql
SELECT mean(temp), hum FROM home
```
This query returns an error.
For more information, see [error about mixing aggregate and non-aggregate queries](/{{< latest "enterprise_influxdb" >}}/troubleshooting/errors/#error-parsing-query-mixing-aggregate-and-non-aggregate-queries-is-not-supported).
## Data types and casting operations
The [`SELECT` clause](#select-clause) supports specifying a
[field's](/influxdb/cloud-dedicated/reference/glossary/#field) type and basic
casting operations with the `::` syntax.
```sql
SELECT field_expression::type FROM measurement_expression
```
The `::` syntax allows users to perform basic cast operations in queries.
Currently, InfluxQL supports casting _numeric_ [field values](/influxdb/cloud-dedicated/reference/glossary/#field-value)
to other numeric types.
Casting to an **identifier type** acts as a filter on results and returns only
columns of that specific identifier type along with the `time` column.
{{< flex >}}
{{% flex-content "third" %}}
##### Numeric types
- `float`
- `integer`
- `unsigned`
{{% /flex-content %}}
{{% flex-content "third" %}}
##### Non-numeric types
- `string`
- `boolean`
{{% /flex-content %}}
{{% flex-content "third" %}}
##### Identifier types
- `field`
- `tag`
{{% /flex-content %}}
{{< /flex >}}
{{% note %}}
InfluxQL returns no data if the query attempts to cast a numeric value to a
non-numeric type and vice versa.
{{% /note %}}
When casting a float value to an integer or unsigned integer, the float value
is truncated at the decimal point. No rounding is performed.
## SELECT statement examples
The examples below use the following sample data sets:
- [Get started home sensor data](/influxdb/cloud-dedicated/reference/sample-data/#get-started-home-sensor-data)
- [NOAA Bay Area weather data](/influxdb/cloud-dedicated/reference/sample-data/#noaa-bay-area-weather-data)
{{< expand-wrapper >}}
{{% expand "Select all fields and tags from a measurement" %}}
```sql
SELECT * FROM home
```
{{% influxql/table-meta %}}
Name: home
{{% /influxql/table-meta %}}
{{% influxdb/custom-timestamps %}}
| time | co | hum | room | temp |
| :------------------- | --: | ---: | :---------- | ---: |
| 2022-01-01T08:00:00Z | 0 | 35.9 | Kitchen | 21 |
| 2022-01-01T08:00:00Z | 0 | 35.9 | Living Room | 21.1 |
| 2022-01-01T09:00:00Z | 0 | 36.2 | Kitchen | 23 |
| 2022-01-01T09:00:00Z | 0 | 35.9 | Living Room | 21.4 |
| 2022-01-01T10:00:00Z | 0 | 36.1 | Kitchen | 22.7 |
| 2022-01-01T10:00:00Z | 0 | 36 | Living Room | 21.8 |
| ... | ... | ... | ... | ... |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{% expand "Select specific tags and fields from a measurement" %}}
```sql
SELECT temp, hum, room FROM home
```
{{% influxql/table-meta %}}
Name: home
{{% /influxql/table-meta %}}
{{% influxdb/custom-timestamps %}}
| time | temp | hum | room |
| :------------------- | ---: | ---: | :---------- |
| 2022-01-01T08:00:00Z | 21 | 35.9 | Kitchen |
| 2022-01-01T08:00:00Z | 21.1 | 35.9 | Living Room |
| 2022-01-01T09:00:00Z | 23 | 36.2 | Kitchen |
| 2022-01-01T09:00:00Z | 21.4 | 35.9 | Living Room |
| 2022-01-01T10:00:00Z | 22.7 | 36.1 | Kitchen |
| 2022-01-01T10:00:00Z | 21.8 | 36 | Living Room |
| ... | ... | ... | ... |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{% expand "Select all fields from a measurement" %}}
```sql
SELECT *::field FROM home
```
{{% influxql/table-meta %}}
Name: home
{{% /influxql/table-meta %}}
{{% influxdb/custom-timestamps %}}
| time | co | hum | temp |
| :------------------- | --: | ---: | ---: |
| 2022-01-01T08:00:00Z | 0 | 35.9 | 21 |
| 2022-01-01T08:00:00Z | 0 | 35.9 | 21.1 |
| 2022-01-01T09:00:00Z | 0 | 36.2 | 23 |
| 2022-01-01T09:00:00Z | 0 | 35.9 | 21.4 |
| 2022-01-01T10:00:00Z | 0 | 36.1 | 22.7 |
| 2022-01-01T10:00:00Z | 0 | 36 | 21.8 |
| ... | ... | ... | ... |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{% expand "Select a field from a measurement and perform basic arithmetic" %}}
```sql
SELECT (temp * (9 / 5)) + 32 FROM home
```
{{% influxql/table-meta %}}
Name: home
{{% /influxql/table-meta %}}
{{% influxdb/custom-timestamps %}}
| time | temp |
| :------------------- | ----------------: |
| 2022-01-01T08:00:00Z | 69.80000000000001 |
| 2022-01-01T08:00:00Z | 69.98 |
| 2022-01-01T09:00:00Z | 73.4 |
| 2022-01-01T09:00:00Z | 70.52 |
| 2022-01-01T10:00:00Z | 72.86 |
| 2022-01-01T10:00:00Z | 71.24000000000001 |
| ... | ... |
{{% /influxdb/custom-timestamps %}}
{{% note %}}
**Note:** InfluxDB follows the standard order of operations.
See [InfluxQL mathematical operators](/influxdb/cloud-dedicated/reference/influxql/math-operators/)
for more on supported operators.
{{% /note %}}
{{% /expand %}}
{{% expand "Select all data from more than one measurement" %}}
```sql
SELECT * FROM home, weather
```
{{% influxql/table-meta %}}
Name: weather
{{% /influxql/table-meta %}}
| time | co | hum | location | precip | room | temp | temp_avg | temp_max | temp_min | wind_avg |
| :------------------- | --: | --: | :------------ | -----: | :--- | ---: | -------: | -------: | -------: | -------: |
| 2020-01-01T00:00:00Z | | | Concord | 0 | | | 52 | 66 | 44 | 3.13 |
| 2020-01-01T00:00:00Z | | | San Francisco | 0 | | | 53 | 59 | 47 | 14.32 |
| 2020-01-01T00:00:00Z | | | Hayward | 0 | | | 50 | 57 | 44 | 2.24 |
| 2020-01-02T00:00:00Z | | | San Francisco | 0 | | | 54 | 61 | 49 | 5.82 |
| 2020-01-02T00:00:00Z | | | Hayward | 0 | | | 51 | 60 | 44 | 3.8 |
| 2020-01-02T00:00:00Z | | | Concord | 0 | | | 53 | 66 | 42 | 3.13 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
{{% /expand %}}
{{% expand "Select all data from a fully-qualified measurement (with default retention policy)" %}}
```sql
SELECT * FROM "get-started"..home
```
{{% influxql/table-meta %}}
Name: home
{{% /influxql/table-meta %}}
{{% influxdb/custom-timestamps %}}
| time | co | hum | room | temp |
| :------------------- | --: | ---: | :---------- | ---: |
| 2022-01-01T08:00:00Z | 0 | 35.9 | Kitchen | 21 |
| 2022-01-01T08:00:00Z | 0 | 35.9 | Living Room | 21.1 |
| 2022-01-01T09:00:00Z | 0 | 36.2 | Kitchen | 23 |
| 2022-01-01T09:00:00Z | 0 | 35.9 | Living Room | 21.4 |
| 2022-01-01T10:00:00Z | 0 | 36.1 | Kitchen | 22.7 |
| 2022-01-01T10:00:00Z | 0 | 36 | Living Room | 21.8 |
| ... | ... | ... | ... | ... |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{< /expand-wrapper >}}
### Type-casting examples
{{< expand-wrapper >}}
{{% expand "Cast an integer field to a float" %}}
```sql
SELECT co::float FROM home
```
{{% /expand %}}
{{% expand "Cast a float field to an integer" %}}
```sql
SELECT temp::integer FROM home
```
{{% /expand %}}
{{% expand "Cast a float field to an unsigned integer" %}}
```sql
SELECT temp::unsigned FROM home
```
{{% /expand %}}
{{< /expand-wrapper >}}
<!-- ## Multiple statements
Separate multiple `SELECT` statements in a query with a semicolon (`;`).
### Examples
The **InfluxDB v1 query API** returns a JSON response with a `statement_id`
field for each `SELECT` statement.
```json
{
"results": [
{
"statement_id": 0,
"series": [
{
"name": "h2o_feet",
"columns": [
"time",
"mean"
],
"values": [
[
"1970-01-01T00:00:00Z",
4.442107025822522
]
]
}
]
},
{
"statement_id": 1,
"series": [
{
"name": "h2o_feet",
"columns": [
"time",
"water_level"
],
"values": [
[
"2015-08-18T00:00:00Z",
8.12
],
[
"2015-08-18T00:00:00Z",
2.064
]
]
}
]
}
]
}
``` -->

View File

@ -0,0 +1,374 @@
---
title: Time and time zones
description: >
Explore InfluxQL features used specifically for working with time.
Use the `tz` (time zone) clause to return the UTC offset for the specified
time zone.
menu:
influxdb_cloud_dedicated:
name: Time and time zones
parent: influxql-reference
weight: 208
list_code_example: |
```sql
SELECT_clause FROM_clause [WHERE_clause] [GROUP_BY_clause] [ORDER_BY_clause] [LIMIT_clause] [OFFSET_clause] [SLIMIT_clause] [SOFFSET_clause] tz('<time_zone>')
```
---
InfluxQL is designed for working with time series data and includes features specifically for working with time.
You can review the following ways to work with time and timestamps in your InfluxQL queries:
- [Time syntax](#time-syntax)
- [Add and subtract time values](#add-and-subtract-time-values)
- [Query time range](#query-time-range)
- [Supported operators](#supported-operators)
- [Query examples](#query-examples)
- [Time zone clause](#time-zone-clause)
- [Notable behaviors](#notable-behaviors)
- [Cannot query multiple time ranges](#cannot-query-multiple-time-ranges)
- [Querying future data with a `GROUP BY time()` clause](#querying-future-data-with-a-group-by-time-clause)
## Time syntax
InfluxQL supports the following timestamp literal syntaxes:
```sql
'2006-01-02T15:04:05.00Z' -- RFC3339 date-time string
'2006-01-02 15:04:05.00' -- RFC3339-like date-time string
1136189045000000000 -- Unix nanosecond epoch time
1136189045s -- Unix epoch time
```
- **RFC3339 date-time string**:
[String literal](/influxdb/cloud-dedicated/reference/influxql/#strings) using
the RFC3339 timestamp format, `YYYY-MM-DDTHH:MM:SS.nnnnnnnnnZ`.
- **RFC3339-like date-time string**:
[String literal](/influxdb/cloud-dedicated/reference/influxql/#strings) using
the RFC3339-like timestamp format, `YYYY-MM-DD HH:MM:SS.nnnnnnnnn`.
- **Unix nanosecond epoch time**:
[Integer](/influxdb/cloud-dedicated/reference/influxql/#integers) that
represents the number of nanoseconds elapsed since the
[Unix epoch](/influxdb/cloud-dedicated/reference/glossary/#unix-epoch).
- **Unix epoch time**:
[Duration literal](/influxdb/cloud-dedicated/reference/influxql/#durations)
that represents the number of specified time units elapsed since the
[Unix epoch](/influxdb/cloud-dedicated/reference/glossary/#unix-epoch).
_[View supported duration units](/influxdb/cloud-dedicated/reference/influxql/#durations)_.
##### Supported timestamp values
| | RFC3339 | Unix nanosecond time |
| ----------- | :----------------------------: | -------------------: |
| **Maximum** | 2262-04-11T23:47:16.854775807Z | 9223372036854775807 |
| **Minimum** | 1677-09-21T00:12:43.145224193Z | -9223372036854775807 |
### Add and subtract time values
Timestamp values support addition and subtraction operations with
[duration literals](/influxdb/cloud-dedicated/reference/influxql/#durations).
Add (`+`) or subtract (`-`) a duration to or from a timestamp to return an
updated timestamp.
```sql
'2023-01-01T00:00:00Z' + 2h -- Resolves to 2023-01-01T02:00:00Z
'2023-01-01 00:00:00' - 20h -- Resolves to 2022-12-31T04:00:00Z
1672531200000000000 + 1y -- Resolves to 2024-01-01T00:00:00Z
```
{{% note %}}
InfluxQL requires a whitespace between the `+` operators `-` and the duration literal.
{{% /note %}}
## Query time range
To specify the time range of a query, use conditional expressions in the
[`WHERE` clause](/inflxudb/cloud-dedicated/reference/influxql/where/) that
compare the value of the `time` column to an absolute timestamp or a relative
timestamp.
- **Absolute time range**: Define query time bounds with timestamp literals
```sql
WHERE time >= '2023-01-01T00:00:00Z' AND time <= '2023-07-01T00:00:00Z'
WHERE time >= '2023-01-01 00:00:00' AND time <= '2023-07-01 00:00:00'
WHERE time >= 1672531200000000000 AND time <= 1688169600000000000
WHERE time >= 1672531200s and time <= 1688169600000ms
```
- **Relative time range**: Define query time bounds with a duration literal
added to or subtracted from timestamp literals.
{{% note %}}
Use `now()` to return the current system time (UTC).
{{% /note %}}
```sql
-- Query data from the last day
WHERE time >= now() - 1d
-- Query data from the previous week
WHERE time >= now() - 1w AND time <= now() - 2w
-- Query data relative to a specific time
WHERE time >= '2023-01-01' - 1w AND time <= '2023-01-01' + 1w
```
### Supported operators
Conditional expressions with time operands support the following comparison operators:
| Operator | Meaning |
|:--------:|:------- |
| `=` | equal to |
| `<>` | not equal to |
| `!=` | not equal to |
| `>` | greater than |
| `>=` | greater than or equal to |
| `<` | less than |
| `<=` | less than or equal to |
{{% note %}}
Currently, InfluxQL supports the `AND` logical operator to define query time bounds,
but does not support using the `OR` logical operator to query multiple time ranges.
{{% /note %}}
## Query examples
The following examples use the
[Get started home sensor sample dataset](/influxdb/cloud-dedicated/reference/sample-data/#get-started-home-sensor-data).
{{< expand-wrapper >}}
{{% expand "Specify a time range with RFC3339 date-time strings" %}}
{{% influxdb/custom-timestamps %}}
```sql
SELECT *
FROM home
WHERE
room = 'Kitchen'
AND time >= '2022-01-01T08:00:00Z'
AND time <= '2022-01-01T12:00:00Z'
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | co | hum | room | temp |
| :------------------- | --: | ---: | :------ | ---: |
| 2022-01-01T08:00:00Z | 0 | 35.9 | Kitchen | 21 |
| 2022-01-01T09:00:00Z | 0 | 36.2 | Kitchen | 23 |
| 2022-01-01T10:00:00Z | 0 | 36.1 | Kitchen | 22.7 |
| 2022-01-01T11:00:00Z | 0 | 36 | Kitchen | 22.4 |
| 2022-01-01T12:00:00Z | 0 | 36 | Kitchen | 22.5 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{% expand "Specify a time range with RFC3339-like date-time strings" %}}
{{% influxdb/custom-timestamps %}}
```sql
SELECT *
FROM home
WHERE
room = 'Kitchen'
AND time >= '2022-01-01 08:00:00'
AND time <= '2022-01-01 12:00:00'
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | co | hum | room | temp |
| :------------------- | --: | ---: | :------ | ---: |
| 2022-01-01T08:00:00Z | 0 | 35.9 | Kitchen | 21 |
| 2022-01-01T09:00:00Z | 0 | 36.2 | Kitchen | 23 |
| 2022-01-01T10:00:00Z | 0 | 36.1 | Kitchen | 22.7 |
| 2022-01-01T11:00:00Z | 0 | 36 | Kitchen | 22.4 |
| 2022-01-01T12:00:00Z | 0 | 36 | Kitchen | 22.5 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{% expand "Specify a time range with nanosecond epoch timestamps" %}}
{{% influxdb/custom-timestamps %}}
```sql
SELECT *
FROM home
WHERE
room = 'Kitchen'
AND time >= 1641024000000000000
AND time <= 1641038400000000000
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | co | hum | room | temp |
| :------------------- | --: | ---: | :------ | ---: |
| 2022-01-01T08:00:00Z | 0 | 35.9 | Kitchen | 21 |
| 2022-01-01T09:00:00Z | 0 | 36.2 | Kitchen | 23 |
| 2022-01-01T10:00:00Z | 0 | 36.1 | Kitchen | 22.7 |
| 2022-01-01T11:00:00Z | 0 | 36 | Kitchen | 22.4 |
| 2022-01-01T12:00:00Z | 0 | 36 | Kitchen | 22.5 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{% expand "Specify a time range with second-precision epoch timestamps" %}}
{{% influxdb/custom-timestamps %}}
```sql
SELECT *
FROM home
WHERE
room = 'Kitchen'
AND time >= 1641024000s
AND time <= 1641038400s
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | co | hum | room | temp |
| :------------------- | --: | ---: | :------ | ---: |
| 2022-01-01T08:00:00Z | 0 | 35.9 | Kitchen | 21 |
| 2022-01-01T09:00:00Z | 0 | 36.2 | Kitchen | 23 |
| 2022-01-01T10:00:00Z | 0 | 36.1 | Kitchen | 22.7 |
| 2022-01-01T11:00:00Z | 0 | 36 | Kitchen | 22.4 |
| 2022-01-01T12:00:00Z | 0 | 36 | Kitchen | 22.5 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{% expand "Specify a time range relative to a timestamp" %}}
{{% influxdb/custom-timestamps %}}
```sql
SELECT * FROM home WHERE time >= '2022-01-01T20:00:00Z' - 2h
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | co | hum | room | temp |
| :------------------- | --: | ---: | :---------- | ---: |
| 2022-01-01T18:00:00Z | 18 | 36.9 | Kitchen | 23.3 |
| 2022-01-01T18:00:00Z | 9 | 36.2 | Living Room | 22.8 |
| 2022-01-01T19:00:00Z | 22 | 36.6 | Kitchen | 23.1 |
| 2022-01-01T19:00:00Z | 14 | 36.3 | Living Room | 22.5 |
| 2022-01-01T20:00:00Z | 26 | 36.5 | Kitchen | 22.7 |
| 2022-01-01T20:00:00Z | 17 | 36.4 | Living Room | 22.2 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{% expand "Specify a time range relative to now" %}}
```sql
SELECT * FROM home WHERE time >= now() - 2h
```
{{% /expand %}}
{{< /expand-wrapper >}}
## Time zone clause
{{% warn %}}
InfluxQL in {{< cloud-name >}} does not currently support the time zone clause,
which applies a time zone offset to UTC timestamps in query results.
**Tracking issue**: [influxdb_iox#6933](https://github.com/influxdata/influxdb_iox/issues/6933)
{{% /warn %}}
<!-- By default, InfluxDB stores and returns timestamps in UTC.
Use the time zone clause and the `tz()` function to apply a time zone offset to
UTC times and return timestamps in the specified time zone including any applicable
seasonal offset such as Daylight Savings Time (DST) or British Summer Time (BST).
```sql
SELECT_clause FROM_clause [WHERE_clause] [GROUP_BY_clause] [ORDER_BY_clause] [LIMIT_clause] [OFFSET_clause] [SLIMIT_clause] [SOFFSET_clause] tz('time_zone')
```
- **time_zone**: Time zone string literal to adjust times to.
Uses time zone names defined in the
[Internet Assigned Numbers Authority time zone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List).
### Time zone example
{{< expand-wrapper >}}
{{% expand "Return the UTC offset for Chicago's time zone" %}}
{{% influxdb/custom-timestamps %}}
The following example uses the
[Get started home sensor sample dataset](/influxdb/cloud-dedicated/reference/sample-data/#get-started-home-sensor-data).
```sql
SELECT *
FROM home
WHERE
room = 'Kitchen'
AND time >= '2022-01-01T08:00:00Z'
AND time <= '2022-01-01T12:00:00Z'
tz('America/Chicago')
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | co | hum | room | temp |
| :------------------------ | --: | ---: | :------ | ---: |
| 2022-01-01T02:00:00-06:00 | 0 | 35.9 | Kitchen | 21 |
| 2022-01-01T03:00:00-06:00 | 0 | 36.2 | Kitchen | 23 |
| 2022-01-01T04:00:00-06:00 | 0 | 36.1 | Kitchen | 22.7 |
| 2022-01-01T05:00:00-06:00 | 0 | 36 | Kitchen | 22.4 |
| 2022-01-01T06:00:00-06:00 | 0 | 36 | Kitchen | 22.5 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{< /expand-wrapper >}} -->
## Notable behaviors
- [Cannot query multiple time ranges](#cannot-query-multiple-time-ranges)
- [Querying future data with a `GROUP BY time()` clause](#querying-future-data-with-a-group-by-time-clause)
### Cannot query multiple time ranges
InfluxDB does not support using `OR` in the `WHERE` clause to query multiple time ranges.
For example, the following query returns no results:
{{% influxdb/custom-timestamps %}}
```sql
SELECT *
FROM home
WHERE
(time >= '2022-01-01T08:00:00Z' AND time <= '2022-01-01T10:00:00Z')
OR (time >= '2022-01-01T18:00:00Z' AND time <= '2022-01-01T20:00:00Z')
```
{{% /influxdb/custom-timestamps %}}
### Querying future data with a `GROUP BY time()` clause
Queries that do not specify time bounds in the `WHERE` clause and do not include
a `GROUP BY time()` clause use the [minimum and maximum timestamps](#supported-timestamp-values)
as the default time range.
If the query includes a `GROUP BY time()` clause, the default time range is
between `1677-09-21T00:12:43.145224193Z` and
[`now()`](/influxdb/cloud-dedicated/reference/influxql/functions/date-time/#now).
To query data with timestamps that occur in the future (after `now()`),
provide an explicit upper bound in the `WHERE` clause.

View File

@ -0,0 +1,371 @@
---
title: WHERE clause
description: >
Use the `WHERE` clause to filter data based on [fields](/influxdb/cloud-dedicated/reference/glossary/#field), [tags](/influxdb/cloud-dedicated/reference/glossary/#tag), and/or [timestamps](/influxdb/cloud-dedicated/reference/glossary/#timestamp).
menu:
influxdb_cloud_dedicated:
name: WHERE clause
identifier: influxql-where-clause
parent: influxql-reference
weight: 202
list_code_example: |
```sql
SELECT_clause FROM_clause WHERE <conditional_expression> [(AND|OR) <conditional_expression> [...]]
```
---
Use the `WHERE` clause to filter data based on
[field values](/influxdb/cloud-dedicated/reference/glossary/#field),
[tag values](/influxdb/cloud-dedicated/reference/glossary/#tag), and
[timestamps](/influxdb/cloud-dedicated/reference/glossary/#timestamp).
- [Syntax](#syntax)
- [Operators](#comparison-operators)
- [Comparison operators](#comparison-operators)
- [Logical operators](#logical-operators)
- [Time ranges](#time-ranges)
- [Regular expressions](#regular-expressions)
- [WHERE clause examples](#where-clause-examples)
- [Notable behaviors](#notable-behaviors)
- [Single and double quotes](#single-and-double-quotes)
- [Cannot query multiple time ranges](#cannot-query-multiple-time-ranges)
## Syntax
```sql
SELECT_clause FROM_clause WHERE <conditional_expression> [(AND|OR) <conditional_expression> [...]]
```
- **conditional_expression**: Comparison between two operands that evaluates to
`true` or `false`. Comparison logic is determined by
[operators](#operators) used in the expression.
These expressions can operate on InfluxDB fields, tags, and timestamps.
Use logical operators (`AND`, `OR`) to chain multiple conditional expressions
together.
## Operators
Operators evaluate the relationship between two operands and return
`true` or `false`.
### Comparison operators
| Operator | Meaning | Supported data types |
| :------: | :--------------------------------- | :---------------------- |
| `=` | Equal to | all |
| `<>` | Not equal to | all |
| `!=` | Not equal to | all |
| `>` | Greater than | numeric, timestamp |
| `>=` | Greater than or equal to | numeric, timestamp |
| `<` | Less than | numeric, timestamp |
| `<=` | Less than or equal to | numeric, timestamp |
| `=~` | Matches a regular expression | strings |
| `!~` | Doesn't match a regular expression | strings |
### Logical operators
| Operator | Meaning |
| :------- | :---------------------------------------------------------------------- |
| `AND` | Returns `true` if both operands are `true`. Otherwise, returns `false`. |
| `OR` | Returns `true` if any operand is `true`. Otherwise, returns `false`. |
## Time ranges
Use the `WHERE` clause to specify a time range to query.
If a time range is not defined in the `WHERE` clause, the default time range is
the Unix epoch (`1970-01-01T00:00:00Z`) to _now_.
Timestamps are stored in the `time` columns.
Use comparison operators to compare the value of the `time` column to a
timestamp literal, integer (Unix nanosecond timestamp), or function.
{{< code-tabs-wrapper >}}
{{% code-tabs %}}
[Timestamp](#)
[Integer](#)
[Function](#)
{{% /code-tabs %}}
{{% code-tab-content %}}
```sql
WHERE
time >= '2023-01-01T00:00:00Z'
AND time < '2023-07-01T00:00:00Z'
```
{{% /code-tab-content %}}
{{% code-tab-content %}}
```sql
WHERE
time >= 1672531200000000000
AND time < 1688169600000000000
```
{{% /code-tab-content %}}
{{% code-tab-content %}}
```sql
WHERE
time >= now() - 1d
AND time < now()
```
{{% /code-tab-content %}}
{{< /code-tabs-wrapper >}}
See [Time syntax](/influxdb/cloud-dedicated/reference/influxql/time-and-timezone/#time-syntax)
for information on how to specify alternative time ranges in the `WHERE` clause.
{{% note %}}
InfluxQL [does not support querying multiple time ranges](#cannot-query-multiple-time-ranges).
{{% /note %}}
## Regular expressions
Regular expressions can be used to evaluate _string_ values in the `WHERE` clause
using regular expression comparison operators:
- `=~`: Matches a regular expression
- `!~`: Doesn't match a regular expression
```sql
SELECT * FROM home WHERE room =~ /^K/
```
For more information about InfluxQL regular expression syntax, see
[InfluxQL regular expressions](/influxdb/cloud-dedicated/reference/influxql/regular-expressions/).
## WHERE clause examples
The following examples use the
[Get started home sensor sample dataset](/influxdb/cloud-dedicated/reference/sample-data/#get-started-home-sensor-data).
{{< expand-wrapper >}}
{{% expand "Select data with a specific tag value" %}}
```sql
SELECT * FROM home WHERE room = 'Living Room'
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
{{% influxdb/custom-timestamps %}}
| time | co | hum | room | temp |
| :------------------- | --: | ---: | :---------- | ---: |
| 2022-01-01T08:00:00Z | 0 | 35.9 | Living Room | 21.1 |
| 2022-01-01T09:00:00Z | 0 | 35.9 | Living Room | 21.4 |
| 2022-01-01T10:00:00Z | 0 | 36 | Living Room | 21.8 |
| 2022-01-01T11:00:00Z | 0 | 36 | Living Room | 22.2 |
| 2022-01-01T12:00:00Z | 0 | 35.9 | Living Room | 22.2 |
| ... | ... | ... | ... | ... |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{% expand "Select data from a specific time range" %}}
{{% influxdb/custom-timestamps %}}
```sql
SELECT *
FROM home
WHERE
time >= '2022-01-01T08:00:00Z'
AND time <= '2022-01-01T10:00:00Z'
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | co | hum | room | temp |
| :------------------- | --: | ---: | :---------- | ---: |
| 2022-01-01T08:00:00Z | 0 | 35.9 | Kitchen | 21 |
| 2022-01-01T08:00:00Z | 0 | 35.9 | Living Room | 21.1 |
| 2022-01-01T09:00:00Z | 0 | 36.2 | Kitchen | 23 |
| 2022-01-01T09:00:00Z | 0 | 35.9 | Living Room | 21.4 |
| 2022-01-01T10:00:00Z | 0 | 36.1 | Kitchen | 22.7 |
| 2022-01-01T10:00:00Z | 0 | 36 | Living Room | 21.8 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{% expand "Select data from a relative time range" %}}
{{% influxdb/custom-timestamps %}}
```sql
SELECT * FROM home WHERE time >= '2022-01-01T20:00:00Z' - 2h
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
| time | co | hum | room | temp |
| :------------------- | --: | ---: | :---------- | ---: |
| 2022-01-01T18:00:00Z | 18 | 36.9 | Kitchen | 23.3 |
| 2022-01-01T18:00:00Z | 9 | 36.2 | Living Room | 22.8 |
| 2022-01-01T19:00:00Z | 22 | 36.6 | Kitchen | 23.1 |
| 2022-01-01T19:00:00Z | 14 | 36.3 | Living Room | 22.5 |
| 2022-01-01T20:00:00Z | 26 | 36.5 | Kitchen | 22.7 |
| 2022-01-01T20:00:00Z | 17 | 36.4 | Living Room | 22.2 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{% expand "Select field values above a threshold" %}}
```sql
SELECT co FROM home WHERE co > 9
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
{{% influxdb/custom-timestamps %}}
| time | co |
| :------------------- | --: |
| 2022-01-01T18:00:00Z | 18 |
| 2022-01-01T19:00:00Z | 14 |
| 2022-01-01T19:00:00Z | 22 |
| 2022-01-01T20:00:00Z | 17 |
| 2022-01-01T20:00:00Z | 26 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{% expand "Select specific field values" %}}
```sql
SELECT room, co FROM home WHERE co = 9
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
{{% influxdb/custom-timestamps %}}
| time | room | co |
| :------------------- | :---------- | --: |
| 2022-01-01T17:00:00Z | Kitchen | 9 |
| 2022-01-01T18:00:00Z | Living Room | 9 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{% expand "Select field values based on arithmetic" %}}
```sql
SELECT room, co FROM home WHERE co - 10 > 5
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
{{% influxdb/custom-timestamps %}}
| time | room | co |
| :------------------- | :---------- | --: |
| 2022-01-01T18:00:00Z | Kitchen | 18 |
| 2022-01-01T19:00:00Z | Kitchen | 22 |
| 2022-01-01T20:00:00Z | Living Room | 17 |
| 2022-01-01T20:00:00Z | Kitchen | 26 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{% expand "Select data with field values above a threshold and a specific tag value" %}}
```sql
SELECT * FROM home WHERE temp > 22.7 AND room = 'Kitchen'
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
{{% influxdb/custom-timestamps %}}
| time | co | hum | room | temp |
| :------------------- | --: | ---: | :------ | ---: |
| 2022-01-01T09:00:00Z | 0 | 36.2 | Kitchen | 23 |
| 2022-01-01T13:00:00Z | 1 | 36.5 | Kitchen | 22.8 |
| 2022-01-01T14:00:00Z | 1 | 36.3 | Kitchen | 22.8 |
| 2022-01-01T18:00:00Z | 18 | 36.9 | Kitchen | 23.3 |
| 2022-01-01T19:00:00Z | 22 | 36.6 | Kitchen | 23.1 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{% expand "Select data based on the relationship between columns" %}}
```sql
SELECT co, temp FROM home WHERE co > temp
```
{{% influxql/table-meta %}}
name: home
{{% /influxql/table-meta %}}
{{% influxdb/custom-timestamps %}}
| time | co | temp |
| :------------------- | --: | ---: |
| 2022-01-01T20:00:00Z | 26 | 22.7 |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{< /expand-wrapper >}}
## Notable behaviors
- [Single and double quotes](#single-and-double-quotes)
- [Cannot query multiple time ranges](#cannot-query-multiple-time-ranges)
### Single and double quotes
In InfluxQL, single quotation marks (`'`) and double quotation marks (`"`) work
differently and can alter the way a `WHERE` clause functions.
Single quotes are used in [string](/influxdb/cloud-dedicated/reference/influxql/#strings)
and [timestamp](/influxdb/cloud-dedicated/reference/influxql/#dates--times) literals.
Double quotes are used to quote [identifiers](/influxdb/cloud-dedicated/reference/influxql/#identifiers),
(time, field, and tag column names).
For example, the following conditional expression compares the value of the
`location` _column_ to the _literal string_, `London`:
```sql
"location" = 'London'
```
The following conditional expression compares the value of the `location` _column_
to the value of the `London` _column_:
```sql
"location" = "London"
```
Misused double and single quotes in the `WHERE` clause often results in unexpected
empty query results.
For more information about quotation marks, see
[InfluxQL quotation](/influxdb/cloud-dedicated/reference/influxql/quoting/).
### Cannot query multiple time ranges
InfluxDB does not support using `OR` in the `WHERE` clause to query multiple time ranges.
For example, the following query returns no results:
{{% influxdb/custom-timestamps %}}
```sql
SELECT *
FROM home
WHERE
(time >= '2022-01-01T08:00:00Z' AND time <= '2022-01-01T10:00:00Z')
OR (time >= '2022-01-01T18:00:00Z' AND time <= '2022-01-01T20:00:00Z')
```
{{% /influxdb/custom-timestamps %}}

View File

@ -0,0 +1,423 @@
---
title: Sample data
description: >
Sample datasets are used throughout the the InfluxDB Cloud Dedicated
documentation to demonstrate functionality.
Use the following sample datasets to replicate provided examples.
menu:
influxdb_cloud_dedicated:
name: Sample data
parent: Reference
weight: 110
---
Sample datasets are used throughout the {{< cloud-name >}} documentation to
demonstrate functionality.
Use the following sample datasets to replicate provided examples.
- [Get started home sensor data](#get-started-home-sensor-data)
- [NOAA Bay Area weather data](#noaa-bay-area-weather-data)
- [Bitcoin price data](#bitcoin-price-data)
- [Random numbers sample data](#random-numbers-sample-data)
## Get started home sensor data
Includes hourly home sensor data used in the
[Get started with {{< cloud-name >}}](/influxdb/cloud-dedicated/get-started/) guide.
This dataset includes anomalous sensor readings and helps to demonstrate
processing and alerting on time series data.
To customize timestamps in the dataset, use the {{< icon "clock" >}} button in
the lower right corner of the page.
This lets you modify the sample dataset to stay within the retention period of
the database you write it to.
##### Time Range
**{{% influxdb/custom-timestamps-span %}}2022-01-01T08:00:00Z{{% /influxdb/custom-timestamps-span %}}**
to
**{{% influxdb/custom-timestamps-span %}}2022-01-01T20:00:00Z{{% /influxdb/custom-timestamps-span %}}**
<em style="opacity: .5">(Customizable)</em>
##### Schema
- home <em style="opacity: .5">(measurement)</em>
- **tags**:
- room
- Kitchen
- Living Room
- **fields**:
- co <em style="opacity: .5">(integer)</em>
- temp <em style="opacity: .5">(float)</em>
- hum <em style="opacity: .5">(float)</em>
{{< expand-wrapper >}}
{{% expand "Write home sensor data to InfluxDB" %}}
#### Write the home sensor data to InfluxDB
Use the InfluxDB v2 or v1 API to write the Get started home sensor sample data
to {{< cloud-name >}}.
Replace the following in the script below:
- `DATABASE_NAME`: your InfluxDB Cloud Dedicated database
- `DATABASE_TOKEN`: a [database token](/influxdb/cloud-dedicated/admin/tokens/)
with _write_ permission to the database
{{< code-tabs-wrapper >}}
{{% code-tabs %}}
[v2 API](#)
[v1 API](#)
{{% /code-tabs %}}
{{% code-tab-content %}}
{{% influxdb/custom-timestamps %}}
{{% code-callout "DATABASE_TOKEN|DATABASE_NAME" "magenta" %}}
```sh
export INFLUX_HOST=https://cluster-id.influxdb.io
export INFLUX_TOKEN=DATABASE_TOKEN
INFLUX_DATABASE=DATABASE_NAME
curl --request POST \
"$INFLUX_HOST/api/v2/write?bucket=$INFLUX_DATABASE&precision=s" \
--header "Authorization: Bearer $INFLUX_TOKEN" \
--header "Content-Type: text/plain; charset=utf-8" \
--header "Accept: application/json" \
--data-binary "
home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1641024000
home,room=Kitchen temp=21.0,hum=35.9,co=0i 1641024000
home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1641027600
home,room=Kitchen temp=23.0,hum=36.2,co=0i 1641027600
home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1641031200
home,room=Kitchen temp=22.7,hum=36.1,co=0i 1641031200
home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1641034800
home,room=Kitchen temp=22.4,hum=36.0,co=0i 1641034800
home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1641038400
home,room=Kitchen temp=22.5,hum=36.0,co=0i 1641038400
home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1641042000
home,room=Kitchen temp=22.8,hum=36.5,co=1i 1641042000
home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1641045600
home,room=Kitchen temp=22.8,hum=36.3,co=1i 1641045600
home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1641049200
home,room=Kitchen temp=22.7,hum=36.2,co=3i 1641049200
home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1641052800
home,room=Kitchen temp=22.4,hum=36.0,co=7i 1641052800
home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1641056400
home,room=Kitchen temp=22.7,hum=36.0,co=9i 1641056400
home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1641060000
home,room=Kitchen temp=23.3,hum=36.9,co=18i 1641060000
home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1641063600
home,room=Kitchen temp=23.1,hum=36.6,co=22i 1641063600
home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1641067200
home,room=Kitchen temp=22.7,hum=36.5,co=26i 1641067200
"
```
{{% /code-callout %}}
{{% /influxdb/custom-timestamps %}}
{{% /code-tab-content %}}
{{% code-tab-content %}}
{{% influxdb/custom-timestamps %}}
{{% code-callout "DATABASE_TOKEN|DATABASE_NAME" "magenta" %}}
```sh
export INFLUX_HOST=https://cluster-id.influxdb.io
export INFLUX_TOKEN=DATABASE_TOKEN
INFLUX_DATABASE=DATABASE_NAME
curl --request POST \
"$INFLUX_HOST/write?db=$INFLUX_DATABASE&precision=s" \
--header "Authorization: Bearer $INFLUX_TOKEN" \
--header "Content-type: text/plain; charset=utf-8" \
--data-binary "
home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1641024000
home,room=Kitchen temp=21.0,hum=35.9,co=0i 1641024000
home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1641027600
home,room=Kitchen temp=23.0,hum=36.2,co=0i 1641027600
home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1641031200
home,room=Kitchen temp=22.7,hum=36.1,co=0i 1641031200
home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1641034800
home,room=Kitchen temp=22.4,hum=36.0,co=0i 1641034800
home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1641038400
home,room=Kitchen temp=22.5,hum=36.0,co=0i 1641038400
home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1641042000
home,room=Kitchen temp=22.8,hum=36.5,co=1i 1641042000
home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1641045600
home,room=Kitchen temp=22.8,hum=36.3,co=1i 1641045600
home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1641049200
home,room=Kitchen temp=22.7,hum=36.2,co=3i 1641049200
home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1641052800
home,room=Kitchen temp=22.4,hum=36.0,co=7i 1641052800
home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1641056400
home,room=Kitchen temp=22.7,hum=36.0,co=9i 1641056400
home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1641060000
home,room=Kitchen temp=23.3,hum=36.9,co=18i 1641060000
home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1641063600
home,room=Kitchen temp=23.1,hum=36.6,co=22i 1641063600
home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1641067200
home,room=Kitchen temp=22.7,hum=36.5,co=26i 1641067200
"
```
{{% /code-callout %}}
{{% /influxdb/custom-timestamps %}}
{{% /code-tab-content %}}
{{< /code-tabs-wrapper >}}
{{% /expand %}}
{{< /expand-wrapper >}}
## NOAA Bay Area weather data
Includes daily weather metrics from three San Francisco Bay Area airports from
**January 1, 2020 to December 31, 2022**.
This sample dataset includes seasonal trends and is good for exploring time
series use cases that involve seasonality.
##### Time Range
**2020-01-01T00:00:00Z** to **2022-12-31T00:00:00Z**
##### Schema
- weather <em style="opacity: .5">(measurement)</em>
- **tags**:
- location
- Concord
- Hayward
- San Francisco
- **fields**
- precip <em style="opacity: .5">(float)</em>
- temp_avg <em style="opacity: .5">(float)</em>
- temp_max <em style="opacity: .5">(float)</em>
- temp_min <em style="opacity: .5">(float)</em>
- wind_avg <em style="opacity: .5">(float)</em>
{{< expand-wrapper >}}
{{% expand "Write the NOAA Bay Area weather data to InfluxDB" %}}
#### Write the NOAA Bay Area weather data to InfluxDB
Use the InfluxDB v2 or v1 API to write the NOAA Bay Area weather sample data to
{{< cloud-name >}}.
Replace the following in the script below:
- `DATABASE_NAME`: your InfluxDB Cloud Dedicated database
- `DATABASE_TOKEN`: a [database token](/influxdb/cloud-dedicated/admin/tokens/)
with sufficient permissions to the database
{{< code-tabs-wrapper >}}
{{% code-tabs %}}
[v2 API](#)
[v1 API](#)
{{% /code-tabs %}}
{{% code-tab-content %}}
{{% code-callout "DATABASE_TOKEN|DATABASE_NAME" "magenta" %}}
```sh
export INFLUX_HOST=http://cluster-id.influxdb.io
export INFLUX_TOKEN=DATABASE_TOKEN
INFLUX_DATABASE=DATABASE_NAME
curl --request POST \
"$INFLUX_HOST/api/v2/write?bucket=$INFLUX_DATABASE" \
--header "Authorization: Bearer $INFLUX_TOKEN" \
--header "Content-Type: text/plain; charset=utf-8" \
--header "Accept: application/json" \
--data-binary "$(curl --request GET https://docs.influxdata.com/downloads/bay-area-weather.lp)"
```
{{% /code-callout %}}
{{% /code-tab-content %}}
{{% code-tab-content %}}
{{% code-callout "DATABASE_TOKEN|DATABASE_NAME" "magenta" %}}
```sh
export INFLUX_HOST=http://cluster-id.influxdb.io
export INFLUX_TOKEN=DATABASE_TOKEN
INFLUX_DATABASE=DATABASE_NAME
curl --request POST \
"$INFLUX_HOST/write?db=$INFLUX_DATABASE" \
--header "Authorization: Bearer $INFLUX_TOKEN" \
--header "Content-type: text/plain; charset=utf-8" \
--data-binary "$(curl --request GET https://docs.influxdata.com/downloads/bay-area-weather.lp)"
```
{{% /code-callout %}}
{{% /code-tab-content %}}
{{< /code-tabs-wrapper >}}
{{% /expand %}}
{{< /expand-wrapper >}}
## Bitcoin price data
The Bitcoin price sample dataset provides Bitcoin prices from
**2023-05-01T00:00:00Z to 2023-05-15T00:00:00Z**—_[Powered by CoinDesk](https://www.coindesk.com/price/bitcoin)_.
##### Time Range
**2023-05-01T00:19:00Z** to **2023-05-14T23:48:00Z**
##### Schema
- bitcoin <em style="opacity: .5">(measurement)</em>
- **tags**:
- code
- EUR
- GBP
- USD
- crypto
- bitcoin
- description
- Euro
- British Pound Sterling
- United States Dollar
- symbol
- \&euro; <em style="opacity: .5">(&euro;)</em>
- \&pound; <em style="opacity: .5">(&pound;)</em>
- \&#36; <em style="opacity: .5">(&#36;)</em>
- **fields**
- price <em style="opacity: .5">(float)</em>
{{< expand-wrapper >}}
{{% expand "Write the Bitcoin sample data to InfluxDB" %}}
#### Write the Bitcoin price sample data to InfluxDB
Use the InfluxDB v2 or v1 API to write the Bitcoin price sample data to
{{< cloud-name >}}.
Replace the following in the script below:
- `DATABASE_NAME`: your InfluxDB Cloud Dedicated database
- `DATABASE_TOKEN`: a [database token](/influxdb/cloud-dedicated/admin/tokens/)
with sufficient permissions to the database
{{< code-tabs-wrapper >}}
{{% code-tabs %}}
[v2 API](#)
[v1 API](#)
{{% /code-tabs %}}
{{% code-tab-content %}}
{{% code-callout "DATABASE_TOKEN|DATABASE_NAME" "magenta" %}}
```sh
export INFLUX_HOST=https://cluster-id.influxdb.io
export INFLUX_TOKEN=DATABASE_TOKEN
INFLUX_DATABASE=DATABASE_NAME
curl --request POST \
"$INFLUX_HOST/api/v2/write?bucket=$INFLUX_DATABASE" \
--header "Authorization: Bearer $INFLUX_TOKEN" \
--header "Content-Type: text/plain; charset=utf-8" \
--header "Accept: application/json" \
--data-binary "$(curl --request GET https://docs.influxdata.com/downloads/bitcoin.lp)"
```
{{% /code-callout %}}
{{% /code-tab-content %}}
{{% code-tab-content %}}
{{% code-callout "DATABASE_TOKEN|DATABASE_NAME" "magenta" %}}
```sh
export INFLUX_HOST=https://cluster-id.influxdb.io
export INFLUX_TOKEN=DATABASE_TOKEN
INFLUX_DATABASE=DATABASE_NAME
curl --request POST \
"$INFLUX_HOST/write?db=$INFLUX_DATABASE" \
--header "Authorization: Bearer $INFLUX_TOKEN" \
--header "Content-type: text/plain; charset=utf-8" \
--data-binary "$(curl --request GET https://docs.influxdata.com/downloads/bitcoin.lp)"
```
{{% /code-callout %}}
{{% /code-tab-content %}}
{{< /code-tabs-wrapper >}}
{{% /expand %}}
{{< /expand-wrapper >}}
## Random numbers sample data
Includes two fields with randomly generated numbers reported every minute.
Each field has a specific range of randomly generated numbers.
This sample dataset is used to demonstrate mathematic operations and
transformation functions.
##### Time Range
**2023-01-01T00:00:00Z** to **2023-01-01T12:00:00Z**
##### Schema
- numbers <em style="opacity: .5">(measurement)</em>
- **fields**
- a <em style="opacity: .5">(float between -1 and 1)</em>
- b <em style="opacity: .5">(float between -3 and 3)</em>
{{< expand-wrapper >}}
{{% expand "Write the random number sample data to InfluxDB" %}}
#### Write the random number sample data to InfluxDB
Use the InfluxDB v2 or v1 API to write the random number sample data to
{{< cloud-name >}}.
Replace the following in the script below:
- `DATABASE_NAME`: your InfluxDB Cloud Dedicated database
- `DATABASE_TOKEN`: a [database token](/influxdb/cloud-dedicated/admin/tokens/)
with sufficient permissions to the database
{{< code-tabs-wrapper >}}
{{% code-tabs %}}
[v2 API](#)
[v1 API](#)
{{% /code-tabs %}}
{{% code-tab-content %}}
{{% code-callout "DATABASE_TOKEN|DATABASE_NAME" "magenta" %}}
```sh
export INFLUX_HOST=http://cluster-id.influxdb.io
export INFLUX_TOKEN=DATABASE_TOKEN
INFLUX_DATABASE=DATABASE_NAME
curl --request POST \
"$INFLUX_HOST/api/v2/write?bucket=$INFLUX_DATABASE" \
--header "Authorization: Bearer $INFLUX_TOKEN" \
--header "Content-Type: text/plain; charset=utf-8" \
--header "Accept: application/json" \
--data-binary "$(curl --request GET https://docs.influxdata.com/downloads/random-numbers.lp)"
```
{{% /code-callout %}}
{{% /code-tab-content %}}
{{% code-tab-content %}}
{{% code-callout "DATABASE_TOKEN|DATABASE_NAME" "magenta" %}}
```sh
export INFLUX_HOST=http://cluster-id.influxdb.io
export INFLUX_TOKEN=DATABASE_TOKEN
INFLUX_DATABASE=DATABASE_NAME
curl --request POST \
"$INFLUX_HOST/write?db=$INFLUX_DATABASE" \
--header "Authorization: Bearer $INFLUX_TOKEN" \
--header "Content-type: text/plain; charset=utf-8" \
--data-binary "$(curl --request GET https://docs.influxdata.com/downloads/random-numbers.lp)"
```
{{% /code-callout %}}
{{% /code-tab-content %}}
{{< /code-tabs-wrapper >}}
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -10,7 +10,7 @@
{{ $keybindings := resources.Get "js/keybindings.js" }}
{{ $fluxGroupKeys := resources.Get "js/flux-group-keys.js" }}
{{ $dateTime := resources.Get "js/datetime.js" }}
{{ $influxdbGSTimestamps := resources.Get "js/get-started-timestamps.js" }}
{{ $influxdbGSTimestamps := resources.Get "js/custom-timestamps.js" }}
{{ $codeControls := resources.Get "js/code-controls.js" }}
{{ $pageFeedback := resources.Get "js/page-feedback.js" }}
{{ $homepageInteractions := resources.Get "js/home-interactions.js" }}
@ -19,7 +19,7 @@
{{ $footerjs := slice $versionSelector $contentInteractions $searchInteractions $listFilters $modals $influxdbURLs $featureCallouts $tabbedContent $notifications $keybindings $codeControls $pageFeedback $homepageInteractions $fluxInfluxDBVersions | resources.Concat "js/footer.bundle.js" | resources.Fingerprint }}
{{ $fluxGroupKeyjs := slice $fluxGroupKeys | resources.Concat "js/flux-group-keys.js" | resources.Fingerprint }}
{{ $dateTimejs := slice $dateTime | resources.Concat "js/datetime.js" | resources.Fingerprint }}
{{ $influxdbGSTimestampsjs := slice $influxdbGSTimestamps | resources.Concat "js/get-started-timestamps.js" | resources.Fingerprint }}
{{ $influxdbGSTimestampsjs := slice $influxdbGSTimestamps | resources.Concat "js/custom-timestamps.js" | resources.Fingerprint }}
{{ $ioxWayfindingjs := slice $ioxWayfinding | resources.Concat "js/iox-wayfinding.js" | resources.Fingerprint }}
<!-- Load cloudUrls array -->

View File

@ -1,4 +1,6 @@
{{- $regex := .Get 0 -}}
{{- $color := .Get 1 | default "green" -}}
{{- $elReplace := print "<span class='code-callout " $color "'>$0</span>" -}}
{{- $code := .Inner | markdownify -}}
{{- $codeCallout := replaceRE $regex "<span class='bp' style='font-weight:bold;margin:0 .15rem'>$0</span>" $code -}}
{{- $codeCallout := replaceRE $regex $elReplace $code -}}
{{ $codeCallout | safeHTML }}

View File

@ -0,0 +1,6 @@
{{- $regex := .Get 0 -}}
{{- $color := .Get 1 | default "magenta" -}}
{{- $elReplace := print "<var class='code-placeholder " $color "'>$0</var>" -}}
{{- $code := .Inner | markdownify -}}
{{- $codeCallout := replaceRE $regex $elReplace $code -}}
{{ $codeCallout | safeHTML }}

View File

@ -0,0 +1,70 @@
<div id="influxql-window-diagram" class="custom-timestamps">
<div id="timerange-label">
</div>
<table>
<thead>
<th align="left">time</th>
<th align="right">field</th>
</thead>
<tr>
<td><span class="exclude">2022-01-01T00:00:00Z</span></td>
<td align="right"><span class="exclude">8</span></td>
</tr>
<tr>
<td><span class="exclude">2022-01-01T00:15:00Z</span></td>
<td align="right"><span class="exclude">4</span></td>
</tr>
<tr>
<td>2022-01-01T00:30:00Z</td>
<td align="right">0</td>
</tr>
<tr>
<td>2022-01-01T00:45:00Z</td>
<td align="right">8</td>
</tr>
<tr>
<td>2022-01-01T01:00:00Z</td>
<td align="right">5</td>
</tr>
<tr>
<td>2022-01-01T01:15:00Z</td>
<td align="right">0</td>
</tr>
<tr>
<td>2022-01-01T01:30:00Z</td>
<td align="right">8</td>
</tr>
<tr>
<td>2022-01-01T01:45:00Z</td>
<td align="right">8</td>
</tr>
<tr>
<td>2022-01-01T02:00:00Z</td>
<td align="right">9</td>
</tr>
<tr>
<td>2022-01-01T02:15:00Z</td>
<td align="right">6</td>
</tr>
<tr>
<td>2022-01-01T02:30:00Z</td>
<td align="right">3</td>
</tr>
<tr>
<td><span class="exclude">2022-01-01T02:45:00Z</span></td>
<td align="right"><span class="exclude">0</span></td>
</tr>
</table>
<div class="windows">
<div class="window-hour">
<p>2022-01-01T00:00:00Z</p>
</div>
<div class="window-hour">
<p>2022-01-01T01:00:00Z</p>
</div>
<div class="window-hour">
<p>2022-01-01T02:00:00Z</p>
</div>
</div>
</div>

View File

@ -240,7 +240,7 @@
{{- else if or (eq $icon "annotate") (eq $icon "pin") -}}
<span class="inline {{ $version }} cf-icon Annotate_New"></span>
{{- else if eq $icon "clock" -}}
<span class="inline {{ $version }} cf-icon Clock_New top small"></span>
<span class="inline {{ $version }} cf-icon Clock_New small"></span>
{{- else if or (eq $icon "handle") (eq $icon "move-cell") (eq $icon "move") -}}
<span class="inline v3 cf-icon handle-new middle xsmall"></span>
{{- else if eq $icon "share" -}}

View File

@ -1 +1 @@
<span class="get-started-timestamps">{{ .Inner }}</span>
<span class="custom-timestamps">{{ .Inner }}</span>

View File

@ -1,3 +1,3 @@
<div class="get-started-timestamps">
<div class="custom-timestamps">
{{ .Inner }}
</div>

File diff suppressed because it is too large Load Diff

3750
static/downloads/bitcoin.lp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,721 @@
numbers a=0.33909108671076,b=-0.163643058925645 1672531200000000000
numbers a=-0.774984088561186,b=0.137034364053949 1672531260000000000
numbers a=-0.921037167720451,b=-0.482943221384294 1672531320000000000
numbers a=-0.73880754843378,b=-0.0729732928756677 1672531380000000000
numbers a=-0.905980032168252,b=1.77857552719844 1672531440000000000
numbers a=-0.891164752631417,b=0.741147445214238 1672531500000000000
numbers a=0.1111323136677,b=0.28767400291042 1672531560000000000
numbers a=-0.29090108178201,b=-0.549246792757896 1672531620000000000
numbers a=-0.68965453529163,b=0.81801552906378 1672531680000000000
numbers a=0.416579917279588,b=-1.18816216391215 1672531740000000000
numbers a=0.32896811695535,b=-1.08759833527982 1672531800000000000
numbers a=0.263585064411983,b=-0.187620086586211 1672531860000000000
numbers a=-0.293007239963642,b=-0.81371037157091 1672531920000000000
numbers a=0.10867789220738,b=-0.339781659874945 1672531980000000000
numbers a=0.81888573537885,b=0.979137411380128 1672532040000000000
numbers a=0.02791281374844,b=0.419563841516462 1672532100000000000
numbers a=-0.0167723143183296,b=0.0789016569071898 1672532160000000000
numbers a=0.430984572944297,b=-0.415802649859945 1672532220000000000
numbers a=-0.0324708722886515,b=-0.430988282039912 1672532280000000000
numbers a=-0.35066291711384,b=0.522400413771175 1672532340000000000
numbers a=-0.6932011348791,b=0.113584203873427 1672532400000000000
numbers a=0.1505860433113,b=-0.0625993158731949 1672532460000000000
numbers a=0.2507110987254,b=-1.82765338171303 1672532520000000000
numbers a=-0.388994455772456,b=-2.23277261856744 1672532580000000000
numbers a=0.537929145338556,b=1.24508364756355 1672532640000000000
numbers a=0.876444236769559,b=0.5411298803071 1672532700000000000
numbers a=-0.334721126669191,b=-0.770385866062664 1672532760000000000
numbers a=-0.185825611256584,b=0.123725882139362 1672532820000000000
numbers a=-0.302942032213107,b=0.779980653464321 1672532880000000000
numbers a=0.391695442618135,b=1.8578413382244 1672532940000000000
numbers a=0.53401267043618,b=0.341497154119073 1672533000000000000
numbers a=-0.00965359498944421,b=0.41832022933686 1672533060000000000
numbers a=-0.518425385308536,b=-0.478295861903183 1672533120000000000
numbers a=-0.883612288987216,b=-0.825002720060539 1672533180000000000
numbers a=-0.409171753111365,b=-2.213605375721 1672533240000000000
numbers a=-0.156361713792947,b=-1.05900942407408 1672533300000000000
numbers a=0.975060007935901,b=-1.1658907671473 1672533360000000000
numbers a=0.00530675710394036,b=0.497221891906345 1672533420000000000
numbers a=0.669252577704012,b=0.0943321873571211 1672533480000000000
numbers a=0.0864626890926602,b=-2.28948715978378 1672533540000000000
numbers a=-0.120828665309051,b=0.181260786239557 1672533600000000000
numbers a=0.40417679290854,b=-0.58526956763464 1672533660000000000
numbers a=-0.188864105037889,b=0.0430742291286603 1672533720000000000
numbers a=0.36311245459558,b=-0.657738901268012 1672533780000000000
numbers a=-0.00306770219829515,b=0.216070604640917 1672533840000000000
numbers a=0.154691036789696,b=-0.706319273502819 1672533900000000000
numbers a=-0.410319362646333,b=-0.101100517819684 1672533960000000000
numbers a=0.129331251586536,b=2.52232997449388 1672534020000000000
numbers a=0.04171547642675,b=-0.776919969904624 1672534080000000000
numbers a=-0.14880371703208,b=-1.15779300646337 1672534140000000000
numbers a=0.206328979698752,b=0.549117947723201 1672534200000000000
numbers a=0.30078877257622,b=0.29498826835001 1672534260000000000
numbers a=-0.102333425327694,b=1.47806566626276 1672534320000000000
numbers a=-0.450007955341662,b=-0.0266972407318951 1672534380000000000
numbers a=-0.173048702340392,b=-0.633421783466255 1672534440000000000
numbers a=0.189555422153928,b=0.0973000194309861 1672534500000000000
numbers a=0.0129433748890814,b=-1.09617146280125 1672534560000000000
numbers a=0.159603788528173,b=1.05710568361984 1672534620000000000
numbers a=0.592830839828915,b=0.463887689488804 1672534680000000000
numbers a=0.816385771113018,b=-1.07484418425107 1672534740000000000
numbers a=-0.790836070736962,b=-0.291332717685282 1672534800000000000
numbers a=-0.0981434375282,b=-0.594110969401357 1672534860000000000
numbers a=-0.166839665978026,b=0.477675539731239 1672534920000000000
numbers a=-0.919355854367657,b=1.43728755481076 1672534980000000000
numbers a=0.746057987347778,b=-1.41486240822572 1672535040000000000
numbers a=0.314422095815882,b=-0.489494264570788 1672535100000000000
numbers a=0.1308339467045,b=0.0826696922638296 1672535160000000000
numbers a=-0.943512051870507,b=0.809377431886159 1672535220000000000
numbers a=-0.633209585420839,b=1.24536349869942 1672535280000000000
numbers a=-0.385319230184424,b=-1.17396860932454 1672535340000000000
numbers a=0.524080954722575,b=1.10514964498832 1672535400000000000
numbers a=0.39914922473945,b=0.246546741613076 1672535460000000000
numbers a=-0.11629892506186,b=0.634168271489215 1672535520000000000
numbers a=-0.184073441729415,b=1.00834772969759 1672535580000000000
numbers a=0.034715099232906,b=-0.510268215880079 1672535640000000000
numbers a=-0.183217252467174,b=-0.631698483282759 1672535700000000000
numbers a=-0.558434346814657,b=0.292113903903678 1672535760000000000
numbers a=0.553002285283919,b=2.1734543386974 1672535820000000000
numbers a=0.938618236860565,b=0.488479217365483 1672535880000000000
numbers a=0.73236302261228,b=-0.0975489695867846 1672535940000000000
numbers a=-0.515490223280789,b=-0.623351351010785 1672536000000000000
numbers a=0.803201312042983,b=-0.781576394911122 1672536060000000000
numbers a=0.970938142399892,b=0.167405053845338 1672536120000000000
numbers a=0.0493748366311344,b=-0.608720522502553 1672536180000000000
numbers a=-0.598910707617183,b=0.55702583961519 1672536240000000000
numbers a=-0.709645583698352,b=-1.07092174389845 1672536300000000000
numbers a=-0.0092248670425,b=-0.242606584358734 1672536360000000000
numbers a=-0.655135139408726,b=1.83065678158833 1672536420000000000
numbers a=-0.399009107155829,b=-2.00299561766326 1672536480000000000
numbers a=0.545870854683267,b=1.04602988537488 1672536540000000000
numbers a=-0.586867318384391,b=0.115327822645403 1672536600000000000
numbers a=0.20468256552478,b=0.491473433670558 1672536660000000000
numbers a=-0.36805058928708,b=-1.14505474601663 1672536720000000000
numbers a=-0.651424374482653,b=0.19958990944449 1672536780000000000
numbers a=0.621920782940944,b=-0.0501932538986873 1672536840000000000
numbers a=-0.904688402351053,b=0.635586402297072 1672536900000000000
numbers a=0.320426016903928,b=-0.323057503978446 1672536960000000000
numbers a=0.08089997707049,b=-0.713176096528649 1672537020000000000
numbers a=0.55323932135623,b=0.00717959838175468 1672537080000000000
numbers a=-0.804691095654623,b=0.356259551771043 1672537140000000000
numbers a=0.779316969163,b=-0.21203025250267 1672537200000000000
numbers a=-0.538878362960695,b=-0.971199633032306 1672537260000000000
numbers a=0.417506955594479,b=-0.606108077330841 1672537320000000000
numbers a=0.309599644353033,b=0.00215125421630183 1672537380000000000
numbers a=0.0570023709559287,b=-1.54458566200563 1672537440000000000
numbers a=0.652285274985864,b=1.3715181032785 1672537500000000000
numbers a=-0.554743594846861,b=-1.04724236140165 1672537560000000000
numbers a=0.33564671195992,b=-0.311475798705668 1672537620000000000
numbers a=0.515476652882475,b=1.54740159740449 1672537680000000000
numbers a=-0.436323308119665,b=-1.16355512842971 1672537740000000000
numbers a=0.9802229493787,b=-0.603404532532874 1672537800000000000
numbers a=-0.162932226425162,b=1.36115812651149 1672537860000000000
numbers a=-0.4700989306993,b=2.00877205540852 1672537920000000000
numbers a=0.51936662433142,b=1.9616325429638 1672537980000000000
numbers a=-0.297726886245977,b=0.855218924845307 1672538040000000000
numbers a=-0.343309016848815,b=1.20964028190775 1672538100000000000
numbers a=-0.748317306658917,b=0.239962073239718 1672538160000000000
numbers a=-0.21033426974743,b=0.0334140861947108 1672538220000000000
numbers a=0.52201821677931,b=0.68708204092209 1672538280000000000
numbers a=-0.786556183459208,b=-1.94905517413311 1672538340000000000
numbers a=-0.30683875029229,b=-0.760010342921669 1672538400000000000
numbers a=0.37696721993855,b=-0.443207454345514 1672538460000000000
numbers a=-0.557345224943134,b=0.244431753119815 1672538520000000000
numbers a=0.730929175401449,b=-1.22471997145498 1672538580000000000
numbers a=0.15775833530705,b=0.789947504484491 1672538640000000000
numbers a=-0.682219195458039,b=-1.39416112053778 1672538700000000000
numbers a=0.654338524879268,b=-1.08500788901849 1672538760000000000
numbers a=-0.352114448401931,b=-1.43185123800534 1672538820000000000
numbers a=-0.504936055986317,b=0.0676641097796302 1672538880000000000
numbers a=0.663962426902797,b=2.17658872223343 1672538940000000000
numbers a=-0.0263149148611698,b=-0.20844752746192 1672539000000000000
numbers a=0.347223875051029,b=-0.736644255491504 1672539060000000000
numbers a=0.00913781269098111,b=0.626952942326315 1672539120000000000
numbers a=0.1239668614126,b=0.408790048243534 1672539180000000000
numbers a=0.0105866328709004,b=0.0786590576633662 1672539240000000000
numbers a=0.926034371398877,b=0.478615561968519 1672539300000000000
numbers a=-0.639062058499389,b=-1.825941747159 1672539360000000000
numbers a=-0.849126312130617,b=1.90462805739326 1672539420000000000
numbers a=0.997428406567464,b=-0.943764068812114 1672539480000000000
numbers a=0.00793636071884711,b=0.48120226665686 1672539540000000000
numbers a=0.76811060029411,b=0.380201458557235 1672539600000000000
numbers a=-0.10021957100258,b=1.3258428921207 1672539660000000000
numbers a=0.334291604823694,b=-1.5324894193861 1672539720000000000
numbers a=-0.31173611323717,b=-1.64712206495421 1672539780000000000
numbers a=-0.374001625311199,b=1.05278111578581 1672539840000000000
numbers a=0.885837950484774,b=2.42185260896631 1672539900000000000
numbers a=0.489479159530245,b=0.79264006335591 1672539960000000000
numbers a=-0.394554490136212,b=-0.979279224057676 1672540020000000000
numbers a=0.247860169031443,b=-0.477826216969739 1672540080000000000
numbers a=0.257223808193782,b=-0.431775336083457 1672540140000000000
numbers a=-0.569848419182847,b=0.149429908059599 1672540200000000000
numbers a=0.733407095575786,b=2.44532861714696 1672540260000000000
numbers a=-0.12771643078371,b=0.422935296371579 1672540320000000000
numbers a=-0.462434571235075,b=-0.188995819226921 1672540380000000000
numbers a=0.534962626841397,b=0.935609261851149 1672540440000000000
numbers a=-0.0254597471474906,b=2.90930630582175 1672540500000000000
numbers a=-0.615937899318028,b=0.753709366648145 1672540560000000000
numbers a=0.0985823653362,b=1.55292347246667 1672540620000000000
numbers a=0.41925389114989,b=0.850486607292255 1672540680000000000
numbers a=-0.65367215734544,b=0.523064012956846 1672540740000000000
numbers a=-0.04741812320228,b=0.934760740465006 1672540800000000000
numbers a=-0.150072827379539,b=1.32942164549932 1672540860000000000
numbers a=-0.147624142607296,b=1.17800671138327 1672540920000000000
numbers a=-0.310615901145529,b=0.585247843250531 1672540980000000000
numbers a=0.250686642842347,b=-0.626544351212829 1672541040000000000
numbers a=-0.11033785976868,b=-0.170292489236772 1672541100000000000
numbers a=-0.499491642733857,b=0.46535080060936 1672541160000000000
numbers a=-0.955793531171186,b=-0.0892907293762774 1672541220000000000
numbers a=0.49386698281744,b=-0.722901981349433 1672541280000000000
numbers a=-0.826853893658076,b=2.19985002098019 1672541340000000000
numbers a=0.131433541040331,b=0.468044183681303 1672541400000000000
numbers a=-0.0366369265088947,b=-0.942237132216037 1672541460000000000
numbers a=0.681464918065615,b=-0.603701167304092 1672541520000000000
numbers a=0.43629019882722,b=0.317416886839331 1672541580000000000
numbers a=-0.677859404856256,b=-0.076994968917395 1672541640000000000
numbers a=-0.465977998990104,b=-0.411259605343373 1672541700000000000
numbers a=-0.875974241410629,b=0.122211695049286 1672541760000000000
numbers a=0.40662985732831,b=1.28334267471972 1672541820000000000
numbers a=0.43620318249985,b=-0.683687267466421 1672541880000000000
numbers a=-0.12894270507133,b=1.02250802398189 1672541940000000000
numbers a=0.2057954298163,b=-2.23385414140702 1672542000000000000
numbers a=-0.221408797287621,b=0.72426068767917 1672542060000000000
numbers a=0.88561142557415,b=-1.82370525229615 1672542120000000000
numbers a=0.164324394380873,b=-0.15150071498722 1672542180000000000
numbers a=0.40664418511597,b=0.110691327460477 1672542240000000000
numbers a=-0.35857230710348,b=-0.210365931119739 1672542300000000000
numbers a=-0.979710427538194,b=-0.034607009477471 1672542360000000000
numbers a=0.00850640671229623,b=0.670796155138785 1672542420000000000
numbers a=-0.50108162741276,b=-0.380523836573213 1672542480000000000
numbers a=0.380570096578701,b=1.25849262202194 1672542540000000000
numbers a=-0.17155825403771,b=0.326151265776417 1672542600000000000
numbers a=0.53585106258892,b=0.873191009037325 1672542660000000000
numbers a=-0.416393708792934,b=-0.811056965552462 1672542720000000000
numbers a=-0.07260591144953,b=0.422625089567271 1672542780000000000
numbers a=-0.610442492009077,b=1.57811260255923 1672542840000000000
numbers a=-0.68503239354469,b=-1.85918573729262 1672542900000000000
numbers a=-0.23549996788711,b=0.62167321865329 1672542960000000000
numbers a=-0.03315766317468,b=0.0483215715014625 1672543020000000000
numbers a=-0.41175966807945,b=1.33737431035351 1672543080000000000
numbers a=0.041229755820474,b=0.0607532045326437 1672543140000000000
numbers a=0.671709346527843,b=-1.64022710290354 1672543200000000000
numbers a=0.32686415045821,b=0.831895185998593 1672543260000000000
numbers a=0.273747913380293,b=1.05549889944376 1672543320000000000
numbers a=0.53699502356739,b=0.272350927240072 1672543380000000000
numbers a=-0.805040229251526,b=0.248626541365349 1672543440000000000
numbers a=0.461505598427724,b=-0.551793373490944 1672543500000000000
numbers a=0.05106846044931,b=0.989072909153262 1672543560000000000
numbers a=0.3595669270531,b=0.0776553658204586 1672543620000000000
numbers a=-0.796510984179447,b=0.706033445726795 1672543680000000000
numbers a=-0.818988273534993,b=0.61842067166157 1672543740000000000
numbers a=0.33842300284434,b=0.395052949636461 1672543800000000000
numbers a=0.97699335637811,b=-1.28696618636014 1672543860000000000
numbers a=-0.22396658875342,b=-1.1821939208241 1672543920000000000
numbers a=0.476462954085025,b=1.40933202078934 1672543980000000000
numbers a=-0.408089376075493,b=0.976215776050891 1672544040000000000
numbers a=-0.0114421985962276,b=0.431196445274862 1672544100000000000
numbers a=-0.0756575198542118,b=0.426821576589547 1672544160000000000
numbers a=-0.09231815593234,b=-0.187645094848551 1672544220000000000
numbers a=0.43329211318865,b=0.548817660815896 1672544280000000000
numbers a=0.0737765450427445,b=-0.697064090910429 1672544340000000000
numbers a=-0.52737971570775,b=-0.898876348413167 1672544400000000000
numbers a=0.58210453614125,b=1.08184927439545 1672544460000000000
numbers a=0.510449641938605,b=1.55121894698871 1672544520000000000
numbers a=-0.510433844623399,b=0.608076071740793 1672544580000000000
numbers a=0.238585777705019,b=0.454609268790003 1672544640000000000
numbers a=-0.727323298999688,b=0.779986492488735 1672544700000000000
numbers a=0.353475467984208,b=-1.63229457041166 1672544760000000000
numbers a=-0.187962975050825,b=-0.398566238788281 1672544820000000000
numbers a=0.657289081383119,b=0.679139614587604 1672544880000000000
numbers a=0.540377616233674,b=-1.00910510287204 1672544940000000000
numbers a=0.135621421071821,b=-1.86688704529227 1672545000000000000
numbers a=0.262426712800935,b=-1.1833236070658 1672545060000000000
numbers a=-0.26151600854139,b=0.423380654097751 1672545120000000000
numbers a=0.15840899206131,b=-1.35480072460503 1672545180000000000
numbers a=0.45654606314881,b=0.90934919651412 1672545240000000000
numbers a=0.194724418911823,b=1.19939956378037 1672545300000000000
numbers a=0.343759658385356,b=1.10109632657698 1672545360000000000
numbers a=-0.14455176123428,b=-0.137902660732267 1672545420000000000
numbers a=-0.320757506813867,b=-0.825758071181881 1672545480000000000
numbers a=-0.220124569906648,b=1.69726360132856 1672545540000000000
numbers a=-0.13313000262579,b=-1.7271312826537 1672545600000000000
numbers a=-0.89128978626355,b=-0.240518104984269 1672545660000000000
numbers a=0.367533721996053,b=0.00329916743335284 1672545720000000000
numbers a=0.763147709302256,b=0.426660795115948 1672545780000000000
numbers a=0.238020476050789,b=1.39446686688365 1672545840000000000
numbers a=0.318128970400179,b=-0.549064953306441 1672545900000000000
numbers a=0.327106174557579,b=-0.179567102897306 1672545960000000000
numbers a=-0.48844079309655,b=0.57730869057469 1672546020000000000
numbers a=-0.36519692862644,b=-0.727316198045354 1672546080000000000
numbers a=-0.19587742448313,b=0.865071453388561 1672546140000000000
numbers a=-0.04878368338596,b=-0.0838224824016727 1672546200000000000
numbers a=-0.00259249722053,b=-1.92923398727987 1672546260000000000
numbers a=0.10912821008454,b=0.545844525916297 1672546320000000000
numbers a=0.926012134672562,b=0.188863786392175 1672546380000000000
numbers a=0.44245162311829,b=-0.454827783736496 1672546440000000000
numbers a=-0.692707501564941,b=-0.520163251879781 1672546500000000000
numbers a=-0.656796802310764,b=0.537826004756904 1672546560000000000
numbers a=0.49367164784366,b=-0.241186651484653 1672546620000000000
numbers a=-0.673135820879328,b=0.121075943617073 1672546680000000000
numbers a=0.618610880390571,b=1.8748568806669 1672546740000000000
numbers a=0.13644346046874,b=-0.291198592915285 1672546800000000000
numbers a=-0.3250646374003,b=0.905023717908332 1672546860000000000
numbers a=-0.2794878325471,b=-1.30178545848913 1672546920000000000
numbers a=0.574305545112434,b=-0.0402556906253422 1672546980000000000
numbers a=-0.33047915046314,b=1.9310934572074 1672547040000000000
numbers a=0.366321984978141,b=-0.773986985589242 1672547100000000000
numbers a=0.42321910691822,b=1.97716562089345 1672547160000000000
numbers a=0.628148396298247,b=-0.95588195998166 1672547220000000000
numbers a=0.0036091181892415,b=0.636463049104164 1672547280000000000
numbers a=0.419144717832225,b=-0.721398365988979 1672547340000000000
numbers a=0.667154178092306,b=1.5762310802382 1672547400000000000
numbers a=-0.309024954671115,b=0.0340965242492998 1672547460000000000
numbers a=-0.0846364158023701,b=1.37279413806552 1672547520000000000
numbers a=0.0666023403802064,b=1.82120869002027 1672547580000000000
numbers a=-0.668197418516476,b=0.195064281472259 1672547640000000000
numbers a=0.12069342228981,b=-0.544170195806416 1672547700000000000
numbers a=-0.33766347224746,b=0.512514635590195 1672547760000000000
numbers a=0.482994807923697,b=1.49330557123964 1672547820000000000
numbers a=-0.18735286822039,b=-1.85745043548974 1672547880000000000
numbers a=-0.05418219488893,b=-1.13843753299525 1672547940000000000
numbers a=0.81547493498999,b=-2.1621509691032 1672548000000000000
numbers a=-0.62520388698298,b=-2.07922640970975 1672548060000000000
numbers a=0.32257282006905,b=-1.53698337643115 1672548120000000000
numbers a=0.582647861458987,b=0.946386770213218 1672548180000000000
numbers a=-0.899838444784596,b=1.08381679914342 1672548240000000000
numbers a=0.506787585974691,b=-0.718393252012727 1672548300000000000
numbers a=-0.93368754665453,b=-2.02898145690623 1672548360000000000
numbers a=-0.33703416310779,b=-0.137895386549328 1672548420000000000
numbers a=-0.0184922162675463,b=0.478326907528682 1672548480000000000
numbers a=0.543251700484269,b=1.31600783064513 1672548540000000000
numbers a=-0.433422154298211,b=-1.65876116108261 1672548600000000000
numbers a=-0.451956487491865,b=0.14486803311421 1672548660000000000
numbers a=0.14366544579568,b=1.50031082140879 1672548720000000000
numbers a=0.0386411681471262,b=0.428445560297901 1672548780000000000
numbers a=-0.738036431654722,b=-0.97682957442315 1672548840000000000
numbers a=-0.51602992796175,b=0.665915298199801 1672548900000000000
numbers a=0.690983164723635,b=0.626962073867664 1672548960000000000
numbers a=0.51351903537482,b=-0.290220523153046 1672549020000000000
numbers a=0.810258431319978,b=0.276633454258715 1672549080000000000
numbers a=0.74920722630333,b=-0.216117915108632 1672549140000000000
numbers a=0.885993871274679,b=1.30353127749983 1672549200000000000
numbers a=0.288099445900682,b=-1.06129617327196 1672549260000000000
numbers a=-0.242028449964267,b=-2.31523524264077 1672549320000000000
numbers a=0.881914140551894,b=-0.14645158501271 1672549380000000000
numbers a=-0.485844673332334,b=1.39600431735619 1672549440000000000
numbers a=0.760573054129991,b=-0.527782532459005 1672549500000000000
numbers a=-0.85250345197118,b=-0.187599413198751 1672549560000000000
numbers a=0.370840728668113,b=0.0348135439011697 1672549620000000000
numbers a=0.0939029398369108,b=0.834253025840428 1672549680000000000
numbers a=-0.888722337567734,b=1.33000549281904 1672549740000000000
numbers a=0.528077220268498,b=1.04078470910592 1672549800000000000
numbers a=0.210814447171831,b=1.77564339641315 1672549860000000000
numbers a=-0.385224871932611,b=0.26655580505838 1672549920000000000
numbers a=-0.22243168753715,b=-0.413062226925447 1672549980000000000
numbers a=-0.0626524070001614,b=0.590829250948758 1672550040000000000
numbers a=0.815846875897254,b=0.853559331048478 1672550100000000000
numbers a=-0.617130012094047,b=1.06238986483973 1672550160000000000
numbers a=0.29469555825053,b=0.0185134365934366 1672550220000000000
numbers a=-0.51166648080714,b=-0.533361476919262 1672550280000000000
numbers a=0.637388152697085,b=2.41454780442559 1672550340000000000
numbers a=0.206661452423539,b=-1.01776820121461 1672550400000000000
numbers a=0.47548238326852,b=0.676959874525338 1672550460000000000
numbers a=0.10458501893089,b=1.15373750243136 1672550520000000000
numbers a=0.668283581414609,b=0.422476688256842 1672550580000000000
numbers a=-0.880688891150629,b=-0.0176299554766456 1672550640000000000
numbers a=0.820078666810171,b=0.160549910556831 1672550700000000000
numbers a=-0.17691056035153,b=-0.97948808245875 1672550760000000000
numbers a=-0.10260954414551,b=1.69834791920748 1672550820000000000
numbers a=0.788690144694652,b=1.27484830601556 1672550880000000000
numbers a=-0.781758783823715,b=-0.247452538034096 1672550940000000000
numbers a=-0.40057253521232,b=1.00934304074193 1672551000000000000
numbers a=-0.136388672030492,b=-0.462285466009707 1672551060000000000
numbers a=0.39096680961246,b=2.23372743228384 1672551120000000000
numbers a=-0.219208851028103,b=-0.627134735451651 1672551180000000000
numbers a=0.69178632193695,b=-1.55103354339303 1672551240000000000
numbers a=0.157367632287336,b=0.967923607486045 1672551300000000000
numbers a=0.513474381229456,b=-0.5279446186837 1672551360000000000
numbers a=-0.204301477934702,b=-1.02917128193337 1672551420000000000
numbers a=-0.04877077935683,b=-2.40195612584148 1672551480000000000
numbers a=-0.507951455599446,b=-0.93040243844459 1672551540000000000
numbers a=0.793004605220181,b=0.69672130041228 1672551600000000000
numbers a=-0.800830066039374,b=1.18400351692351 1672551660000000000
numbers a=-0.15269947418499,b=0.819857775121359 1672551720000000000
numbers a=-0.05912299065646,b=0.348058298051845 1672551780000000000
numbers a=0.693629990640341,b=-0.335266012753796 1672551840000000000
numbers a=-0.517766018772629,b=-0.120482665280589 1672551900000000000
numbers a=-0.07740123058088,b=-0.322653295077704 1672551960000000000
numbers a=0.259788573564694,b=2.39079685241204 1672552020000000000
numbers a=0.251988319973512,b=-0.986053426095608 1672552080000000000
numbers a=-0.0291327906517891,b=-1.83218258236089 1672552140000000000
numbers a=-0.448384324767218,b=-0.323674013246165 1672552200000000000
numbers a=-0.519816813970658,b=0.537435900124513 1672552260000000000
numbers a=0.165215221154545,b=-0.937914736373706 1672552320000000000
numbers a=-0.149540897791004,b=0.552742936299291 1672552380000000000
numbers a=0.37019343562199,b=0.591530927721318 1672552440000000000
numbers a=-0.88764741350065,b=2.44351445505595 1672552500000000000
numbers a=0.27186328549806,b=-0.521198824643451 1672552560000000000
numbers a=-0.390321957481331,b=-0.76340967017739 1672552620000000000
numbers a=-0.844068675365348,b=0.509263758033025 1672552680000000000
numbers a=0.421504923459636,b=-0.284360537113912 1672552740000000000
numbers a=-0.312481241693839,b=-1.91035486964737 1672552800000000000
numbers a=0.39361355667581,b=0.724450601812261 1672552860000000000
numbers a=-0.578091223781732,b=2.46938768887011 1672552920000000000
numbers a=0.595991078023796,b=0.278061375772811 1672552980000000000
numbers a=0.52911950781476,b=-2.04726007216871 1672553040000000000
numbers a=0.281431289583781,b=0.232662864137122 1672553100000000000
numbers a=0.641743890445257,b=0.44744372389615 1672553160000000000
numbers a=0.98249972617437,b=-0.160425569420678 1672553220000000000
numbers a=-0.629737140879467,b=-0.0558111464160298 1672553280000000000
numbers a=0.342441506187773,b=0.945311209456424 1672553340000000000
numbers a=0.18624509368861,b=-2.0412728251118 1672553400000000000
numbers a=-0.843620708505419,b=0.534598082643698 1672553460000000000
numbers a=-0.923246735315284,b=0.948915783916611 1672553520000000000
numbers a=-0.294800751068799,b=0.682548943953817 1672553580000000000
numbers a=0.588367324846191,b=-0.0497556544527779 1672553640000000000
numbers a=-0.552090343034524,b=-0.650327549164364 1672553700000000000
numbers a=0.369421406854862,b=0.0890464009588408 1672553760000000000
numbers a=0.238250735053543,b=2.18515852836242 1672553820000000000
numbers a=-0.27950947483005,b=0.266224682479016 1672553880000000000
numbers a=-0.585143128372091,b=-1.54829604601317 1672553940000000000
numbers a=0.59834315915585,b=-1.16215407194889 1672554000000000000
numbers a=-0.02638105859413,b=-0.50298927807186 1672554060000000000
numbers a=-0.564180807478211,b=0.408698696298145 1672554120000000000
numbers a=-0.31534847545288,b=0.272884164900485 1672554180000000000
numbers a=0.108865752005407,b=-0.145373728334856 1672554240000000000
numbers a=-0.04980616862032,b=-0.677451920170235 1672554300000000000
numbers a=0.932281352145383,b=-1.0808952512487 1672554360000000000
numbers a=-0.77027542465418,b=-0.31047345793757 1672554420000000000
numbers a=-0.0905680942554876,b=-0.439608115801631 1672554480000000000
numbers a=-0.584658112152574,b=-0.706890325958984 1672554540000000000
numbers a=-0.52630918690161,b=-0.200149427678068 1672554600000000000
numbers a=0.88129116867313,b=0.308201633896445 1672554660000000000
numbers a=0.169403671439643,b=-0.028941519033271 1672554720000000000
numbers a=-0.329728075156781,b=-0.314811998890242 1672554780000000000
numbers a=0.5407199210959,b=-0.300739498220152 1672554840000000000
numbers a=-0.660551512207308,b=0.231568346548035 1672554900000000000
numbers a=0.25029019678689,b=-0.23399544655489 1672554960000000000
numbers a=-0.529614270339042,b=-1.10881874444841 1672555020000000000
numbers a=-0.646195974989183,b=-0.507447033723449 1672555080000000000
numbers a=0.0869066696941378,b=-0.521990582690472 1672555140000000000
numbers a=0.957015773925665,b=0.448829215886921 1672555200000000000
numbers a=0.478215282760343,b=1.00867967231486 1672555260000000000
numbers a=-0.388666164087607,b=-0.138705200760532 1672555320000000000
numbers a=-0.0970930923437,b=-0.516816994656445 1672555380000000000
numbers a=-0.443885159094832,b=1.59273420206227 1672555440000000000
numbers a=-0.0145530626210643,b=0.316914951728998 1672555500000000000
numbers a=-0.132570528219815,b=0.391137363853777 1672555560000000000
numbers a=-0.860187679801651,b=-0.781691272105872 1672555620000000000
numbers a=-0.00778786437209909,b=-0.673539085484316 1672555680000000000
numbers a=-0.15476347953001,b=0.59533594512721 1672555740000000000
numbers a=0.694486462994836,b=0.389069196259168 1672555800000000000
numbers a=0.10127030182326,b=0.474558729881925 1672555860000000000
numbers a=-0.369594231740083,b=0.308445902753502 1672555920000000000
numbers a=-0.113872670705533,b=1.77328827679782 1672555980000000000
numbers a=-0.00925475206184708,b=0.382176456514716 1672556040000000000
numbers a=-0.610668950652012,b=0.518259677747347 1672556100000000000
numbers a=0.01401569584763,b=-0.51691906482748 1672556160000000000
numbers a=0.596158005319456,b=0.0467206198830023 1672556220000000000
numbers a=0.179023144601917,b=-0.190274387954046 1672556280000000000
numbers a=-0.31270819537983,b=1.85026662805977 1672556340000000000
numbers a=0.06679602052085,b=0.616388764439202 1672556400000000000
numbers a=0.65053512488282,b=2.07161326388263 1672556460000000000
numbers a=-0.396465784654821,b=0.164581127100997 1672556520000000000
numbers a=-0.13915030856359,b=1.59717784604704 1672556580000000000
numbers a=-0.229706837356932,b=-1.26723512068524 1672556640000000000
numbers a=0.03661336877807,b=-0.1470752410362 1672556700000000000
numbers a=-0.56539552999724,b=0.336665949178452 1672556760000000000
numbers a=-0.526866556449946,b=-0.820177933006061 1672556820000000000
numbers a=0.904171483278835,b=0.488589157232941 1672556880000000000
numbers a=-0.335103537511986,b=-0.861981694231304 1672556940000000000
numbers a=0.251390914549447,b=0.10823227215713 1672557000000000000
numbers a=0.152351711048779,b=-0.180279631058422 1672557060000000000
numbers a=0.691442305222233,b=0.802206990463205 1672557120000000000
numbers a=-0.671741054722767,b=-2.33597106580138 1672557180000000000
numbers a=0.68945314534982,b=1.66682571830297 1672557240000000000
numbers a=-0.55518150501959,b=-1.62922347631213 1672557300000000000
numbers a=0.582637182661747,b=1.12142909672423 1672557360000000000
numbers a=0.331208731349627,b=1.41370089539292 1672557420000000000
numbers a=-0.797197354580022,b=-0.50436239979864 1672557480000000000
numbers a=-0.493260202010062,b=1.34497148666595 1672557540000000000
numbers a=0.775323970654824,b=-0.372742839833464 1672557600000000000
numbers a=-0.67897099962696,b=-0.246358686510164 1672557660000000000
numbers a=-0.52989749006235,b=-0.429722880553966 1672557720000000000
numbers a=-0.761887673792133,b=0.321786558709349 1672557780000000000
numbers a=0.867771314599228,b=-0.905919507631517 1672557840000000000
numbers a=0.895823016819706,b=2.0344999377383 1672557900000000000
numbers a=0.0896237396313864,b=-0.0634391777173493 1672557960000000000
numbers a=-0.07543016328728,b=-1.03684919866602 1672558020000000000
numbers a=-0.0526113034899935,b=0.0344838970091012 1672558080000000000
numbers a=0.149874483443421,b=-1.24728704871337 1672558140000000000
numbers a=-0.466457185369401,b=-0.765395292791906 1672558200000000000
numbers a=-0.33590808201897,b=-0.747880573047984 1672558260000000000
numbers a=-0.733156314325226,b=0.27531260398429 1672558320000000000
numbers a=-0.61426160709762,b=-0.0343696430976614 1672558380000000000
numbers a=0.326102904108285,b=0.861597981768827 1672558440000000000
numbers a=0.995697457301361,b=-0.308525401092739 1672558500000000000
numbers a=-0.0181677037308802,b=-0.243208194992708 1672558560000000000
numbers a=-0.285018282186372,b=-0.732534707166504 1672558620000000000
numbers a=0.052780941492926,b=0.0140271057950325 1672558680000000000
numbers a=0.122520516692569,b=-1.06180004501681 1672558740000000000
numbers a=-0.52053390483838,b=-1.00340420421958 1672558800000000000
numbers a=-0.13694887997175,b=-0.464905458059902 1672558860000000000
numbers a=0.86876018590571,b=-0.262953810816477 1672558920000000000
numbers a=-0.18146552383352,b=1.52620729915659 1672558980000000000
numbers a=-0.638089557877746,b=-0.94362658346377 1672559040000000000
numbers a=0.37946518245013,b=0.0836712932562357 1672559100000000000
numbers a=0.226495059791155,b=-1.16886949963529 1672559160000000000
numbers a=0.927954006048051,b=-0.424759405227662 1672559220000000000
numbers a=0.6122042889392,b=-0.318405130503961 1672559280000000000
numbers a=0.487696290710481,b=-0.741039384912116 1672559340000000000
numbers a=0.84300317989212,b=0.117348197172163 1672559400000000000
numbers a=0.42880148119784,b=-1.20170345425324 1672559460000000000
numbers a=-0.0916861256809181,b=0.970661941352063 1672559520000000000
numbers a=-0.173598904915349,b=1.72262022103516 1672559580000000000
numbers a=0.40204770128989,b=0.599768066997031 1672559640000000000
numbers a=0.96638802590581,b=-0.411025228619261 1672559700000000000
numbers a=-0.69243282513402,b=0.149255076113384 1672559760000000000
numbers a=0.285581860346979,b=-0.651396974426995 1672559820000000000
numbers a=0.512359838233351,b=1.04855413948015 1672559880000000000
numbers a=-0.257150456668225,b=-1.76870888439875 1672559940000000000
numbers a=-0.78273986460176,b=0.893443944919527 1672560000000000000
numbers a=-0.327134285897981,b=-0.440645284115107 1672560060000000000
numbers a=0.51379281033396,b=-0.255594809396762 1672560120000000000
numbers a=0.385260554155,b=0.802857769783604 1672560180000000000
numbers a=0.917600714825154,b=1.59395548432739 1672560240000000000
numbers a=-0.0779882013474728,b=1.24055749688786 1672560300000000000
numbers a=-0.624515386134802,b=-0.973562224310636 1672560360000000000
numbers a=0.68003265749523,b=-2.71902037614563 1672560420000000000
numbers a=0.47855389944047,b=1.56092302137556 1672560480000000000
numbers a=0.58985273704427,b=-0.245460162387303 1672560540000000000
numbers a=0.689752710865326,b=0.79765456109409 1672560600000000000
numbers a=-0.864102911351465,b=1.55549036766323 1672560660000000000
numbers a=0.281463875750551,b=-0.942063318130093 1672560720000000000
numbers a=0.18314661609026,b=-0.912369637779904 1672560780000000000
numbers a=-0.0156571957096822,b=-1.25052165271048 1672560840000000000
numbers a=0.0277464279525381,b=-0.883201901047519 1672560900000000000
numbers a=-0.24388588172579,b=-0.479060782178422 1672560960000000000
numbers a=-0.192659620307195,b=0.28486167044697 1672561020000000000
numbers a=0.743521270069902,b=-0.201124624751144 1672561080000000000
numbers a=-0.87985807652821,b=-1.43044527150074 1672561140000000000
numbers a=0.407898396874794,b=0.0394981977337089 1672561200000000000
numbers a=-0.485696911553796,b=0.0430373702817399 1672561260000000000
numbers a=0.36001744458681,b=0.497565055498307 1672561320000000000
numbers a=0.14108997214736,b=-1.22036656727836 1672561380000000000
numbers a=0.241358116525171,b=-0.262070833026928 1672561440000000000
numbers a=0.172708583477228,b=-1.03179027523927 1672561500000000000
numbers a=-0.442762521224759,b=-0.339283477393687 1672561560000000000
numbers a=-0.75094108224212,b=0.131436837327251 1672561620000000000
numbers a=-0.840784029071182,b=1.05000757565839 1672561680000000000
numbers a=-0.00411917872127659,b=-0.234672064540806 1672561740000000000
numbers a=0.46889446139526,b=0.877865703371814 1672561800000000000
numbers a=0.666477831940906,b=0.469178340345175 1672561860000000000
numbers a=0.234371040600999,b=0.663354855178218 1672561920000000000
numbers a=-0.294311194696215,b=1.62377779963941 1672561980000000000
numbers a=0.21328865694345,b=-1.06576759848099 1672562040000000000
numbers a=0.327320094872737,b=-0.713543941207698 1672562100000000000
numbers a=0.36082434758125,b=-0.786052004212727 1672562160000000000
numbers a=-0.40042928901926,b=0.510192578267939 1672562220000000000
numbers a=0.329252339413067,b=0.933019080311922 1672562280000000000
numbers a=-0.161434683788179,b=-0.511736071739072 1672562340000000000
numbers a=0.101839069163732,b=-0.320428270087911 1672562400000000000
numbers a=0.930125437122722,b=0.226463702144029 1672562460000000000
numbers a=0.530619978565458,b=0.380991807332873 1672562520000000000
numbers a=0.01450121389925,b=-0.000619214699637015 1672562580000000000
numbers a=0.326037701921098,b=-0.603547506521277 1672562640000000000
numbers a=0.420251073688031,b=0.675364756434756 1672562700000000000
numbers a=-0.899972116347489,b=0.775597933199009 1672562760000000000
numbers a=0.1000264180151,b=1.92457597453318 1672562820000000000
numbers a=0.68925784305505,b=0.969406643281221 1672562880000000000
numbers a=-0.29055186822491,b=0.374960694809445 1672562940000000000
numbers a=-0.37823128313383,b=0.339299426936731 1672563000000000000
numbers a=-0.0972293670297621,b=-0.524227634654241 1672563060000000000
numbers a=0.103446908513253,b=-1.69087724596328 1672563120000000000
numbers a=0.665879059060574,b=-1.00976970640899 1672563180000000000
numbers a=-0.38770721871759,b=-0.445979787179788 1672563240000000000
numbers a=-0.22692159285596,b=0.622310329597613 1672563300000000000
numbers a=0.60009050066934,b=-1.18495289490015 1672563360000000000
numbers a=0.54629330688203,b=-1.09485779372171 1672563420000000000
numbers a=0.308450132810061,b=-0.0104409865824422 1672563480000000000
numbers a=-0.42884971563025,b=-0.0962954966757377 1672563540000000000
numbers a=0.292580954600853,b=0.263580519377359 1672563600000000000
numbers a=-0.282404967692872,b=-0.944871780168398 1672563660000000000
numbers a=0.616052839702515,b=-1.03969834616778 1672563720000000000
numbers a=0.1861164760047,b=0.0724232519222205 1672563780000000000
numbers a=0.860089599623767,b=-0.724084452488201 1672563840000000000
numbers a=0.226164707332032,b=-0.297617523674775 1672563900000000000
numbers a=-0.390546637011871,b=1.13503270061704 1672563960000000000
numbers a=0.40833538490903,b=0.341878084677712 1672564020000000000
numbers a=0.41960064803105,b=-0.432305043934907 1672564080000000000
numbers a=0.363338672219472,b=-0.173589283105261 1672564140000000000
numbers a=-0.114784526091692,b=0.573701077994212 1672564200000000000
numbers a=-0.839038167970967,b=1.8099362090783 1672564260000000000
numbers a=0.195107848199525,b=0.909078415539217 1672564320000000000
numbers a=0.06972761256773,b=-0.21758568885018 1672564380000000000
numbers a=-0.255898232000063,b=-1.5098568978499 1672564440000000000
numbers a=-0.942613822304896,b=0.0950168482987022 1672564500000000000
numbers a=-0.07118262446619,b=-0.351481370812328 1672564560000000000
numbers a=-0.04794054740799,b=-0.0405942142971549 1672564620000000000
numbers a=0.800137842906393,b=1.48438806746224 1672564680000000000
numbers a=0.218472892345633,b=1.23102335209584 1672564740000000000
numbers a=-0.30054938494403,b=-0.729522792442504 1672564800000000000
numbers a=-0.725808804619796,b=-0.0357138853342381 1672564860000000000
numbers a=-0.223671697932882,b=1.19745502397408 1672564920000000000
numbers a=-0.643202184301185,b=-1.15609455079935 1672564980000000000
numbers a=0.52788799023635,b=-0.490425818747469 1672565040000000000
numbers a=0.5644326806325,b=-0.844770289786214 1672565100000000000
numbers a=-0.128041173978386,b=-0.902300968634471 1672565160000000000
numbers a=-0.556719301205506,b=-0.980583072034151 1672565220000000000
numbers a=0.815304593260642,b=-0.70389507435009 1672565280000000000
numbers a=0.349306241658901,b=0.915521773285017 1672565340000000000
numbers a=-0.616575545810454,b=-0.766029659220535 1672565400000000000
numbers a=-0.6634400854626,b=-0.193659552678535 1672565460000000000
numbers a=0.104363034309312,b=-1.28416408787057 1672565520000000000
numbers a=-0.609751839059211,b=-0.716739728264339 1672565580000000000
numbers a=-0.10422373625465,b=-0.875773597182771 1672565640000000000
numbers a=-0.1273100222707,b=1.64866136838455 1672565700000000000
numbers a=-0.698845505368005,b=-0.532979268719698 1672565760000000000
numbers a=-0.306974230706678,b=-0.341544003238416 1672565820000000000
numbers a=0.62143903293096,b=-1.79761305676148 1672565880000000000
numbers a=-0.682598300903728,b=-0.288634387628554 1672565940000000000
numbers a=-0.09831948458318,b=0.722901680217433 1672566000000000000
numbers a=0.258374011684042,b=-0.0873012223935247 1672566060000000000
numbers a=0.292936544083889,b=0.72721222304193 1672566120000000000
numbers a=-0.280133166709056,b=-0.346711977530145 1672566180000000000
numbers a=-0.146658229435056,b=0.105065400726345 1672566240000000000
numbers a=-0.86756823355105,b=-0.57782044949664 1672566300000000000
numbers a=-0.37836559062898,b=0.0685984579786827 1672566360000000000
numbers a=-0.190885326233972,b=-0.122751348506816 1672566420000000000
numbers a=0.662060541821879,b=0.962985570818514 1672566480000000000
numbers a=0.27992821987523,b=0.706863972294963 1672566540000000000
numbers a=-0.981767938374221,b=1.14687642718183 1672566600000000000
numbers a=0.841076475326175,b=1.24227761778918 1672566660000000000
numbers a=0.26638934873021,b=-0.759637278307961 1672566720000000000
numbers a=0.891686746033912,b=-0.518059894298091 1672566780000000000
numbers a=-0.362251191555944,b=0.260331168943464 1672566840000000000
numbers a=-0.849314388291402,b=1.16464614629602 1672566900000000000
numbers a=0.486243267572929,b=0.80167325996406 1672566960000000000
numbers a=-0.193482496404833,b=-0.0686788384245189 1672567020000000000
numbers a=-0.821936333626835,b=0.71653009637547 1672567080000000000
numbers a=-0.894984143522961,b=0.210140319401761 1672567140000000000
numbers a=0.421203833284632,b=0.0553169084325696 1672567200000000000
numbers a=-0.48228602138282,b=-0.669511822079095 1672567260000000000
numbers a=-0.40584991859415,b=1.27808159119672 1672567320000000000
numbers a=0.816085725512464,b=0.0011372904952215 1672567380000000000
numbers a=0.314904114806286,b=-1.79571305489965 1672567440000000000
numbers a=0.722518448318957,b=1.52928756505433 1672567500000000000
numbers a=-0.11116835772899,b=1.10835336777599 1672567560000000000
numbers a=0.0158961702417131,b=1.34576205563121 1672567620000000000
numbers a=0.05161242826969,b=-1.86045992632538 1672567680000000000
numbers a=0.712259442126791,b=-1.65945194087292 1672567740000000000
numbers a=0.00037649596288,b=-1.43701159572451 1672567800000000000
numbers a=0.885905979522009,b=1.04996774805342 1672567860000000000
numbers a=0.132624218274757,b=-0.0345271749947435 1672567920000000000
numbers a=0.275790571349221,b=-0.826479823651628 1672567980000000000
numbers a=-0.52154953621244,b=-1.29618922818571 1672568040000000000
numbers a=0.632698375208485,b=0.403090051255867 1672568100000000000
numbers a=-0.241467160390308,b=-1.34641065687174 1672568160000000000
numbers a=0.163943577096338,b=-0.82046894331661 1672568220000000000
numbers a=0.320455048159,b=0.0920029029035086 1672568280000000000
numbers a=0.0792055881690516,b=0.916586839898995 1672568340000000000
numbers a=-0.879615260607668,b=-0.151554183113787 1672568400000000000
numbers a=-0.951491445529863,b=-1.96662687036766 1672568460000000000
numbers a=-0.218909009996703,b=-0.802524929296915 1672568520000000000
numbers a=-0.90057288548347,b=-1.86568424993251 1672568580000000000
numbers a=-0.457004496568584,b=0.14439198363996 1672568640000000000
numbers a=-0.00851719436387,b=1.39112045937908 1672568700000000000
numbers a=0.452215035423262,b=0.912155309297274 1672568760000000000
numbers a=-0.21983660407845,b=-0.969339436819475 1672568820000000000
numbers a=0.0903962303837,b=0.247391490032165 1672568880000000000
numbers a=0.145974197799232,b=0.327401779370653 1672568940000000000
numbers a=-0.135751330819104,b=0.498693316018523 1672569000000000000
numbers a=-0.363006780372493,b=0.604999647596944 1672569060000000000
numbers a=-0.639270431125735,b=-1.27894691340444 1672569120000000000
numbers a=-0.63300240432331,b=0.536634119651533 1672569180000000000
numbers a=-0.816861197757421,b=-0.731156169186606 1672569240000000000
numbers a=-0.185613818222945,b=0.481554789613336 1672569300000000000
numbers a=-0.16024000637774,b=1.03861549965378 1672569360000000000
numbers a=-0.0753007138138912,b=0.0858771938145886 1672569420000000000
numbers a=-0.341004380189773,b=0.859908781835002 1672569480000000000
numbers a=-0.39349512078517,b=1.40606392889605 1672569540000000000
numbers a=0.500732179036368,b=1.06386707568486 1672569600000000000
numbers a=0.28633840945783,b=0.532406199667599 1672569660000000000
numbers a=0.703805195806669,b=-2.1172783483934 1672569720000000000
numbers a=-0.322474359362007,b=0.488394284592529 1672569780000000000
numbers a=0.44113042970678,b=-0.165672504746475 1672569840000000000
numbers a=0.450161671880831,b=0.161491611172071 1672569900000000000
numbers a=-0.12664986795845,b=0.100732376390807 1672569960000000000
numbers a=0.614600395768517,b=0.327237427815873 1672570020000000000
numbers a=0.52447640178498,b=0.456086562670472 1672570080000000000
numbers a=-0.552850151557571,b=1.12886836303368 1672570140000000000
numbers a=0.12278742289645,b=1.75348124681508 1672570200000000000
numbers a=-0.605315175962585,b=-1.23649808177672 1672570260000000000
numbers a=0.813000944291271,b=0.21743008637794 1672570320000000000
numbers a=0.67625488941704,b=1.46493780582342 1672570380000000000
numbers a=-0.17595490573083,b=0.736714982323154 1672570440000000000
numbers a=0.0793808471240325,b=-0.0259018082036023 1672570500000000000
numbers a=-0.12061919372228,b=1.10277004889899 1672570560000000000
numbers a=-0.97526284697324,b=-1.32518833417675 1672570620000000000
numbers a=-0.160272784518024,b=0.582029560811501 1672570680000000000
numbers a=-0.16679992839635,b=0.539995458128736 1672570740000000000
numbers a=0.31321954847728,b=-1.99571635230151 1672570800000000000
numbers a=-0.466221442660916,b=-0.026381006383596 1672570860000000000
numbers a=-0.627627000752543,b=-0.400892142600988 1672570920000000000
numbers a=0.430952474130714,b=0.195952729821389 1672570980000000000
numbers a=-0.459024158372958,b=0.444653034391832 1672571040000000000
numbers a=-0.0885124463563442,b=1.46293002596682 1672571100000000000
numbers a=0.953418017964372,b=0.261937311926734 1672571160000000000
numbers a=-0.252481029678259,b=1.6671391832343 1672571220000000000
numbers a=0.81856173032541,b=-0.65592943641614 1672571280000000000
numbers a=0.22621372312442,b=0.650774026814565 1672571340000000000
numbers a=0.25415987998479,b=-0.41165461624074 1672571400000000000
numbers a=0.66704261715162,b=-0.573970777733763 1672571460000000000
numbers a=-0.0284882288960415,b=0.527436931526218 1672571520000000000
numbers a=0.544007218757981,b=0.564959039995594 1672571580000000000
numbers a=0.0777482883131324,b=0.183895319084029 1672571640000000000
numbers a=0.165019613267275,b=1.08706554001656 1672571700000000000
numbers a=0.0607223873529726,b=1.29705658575694 1672571760000000000
numbers a=-0.591619530942222,b=0.300813940495678 1672571820000000000
numbers a=-0.182170182495062,b=1.89072464060695 1672571880000000000
numbers a=-0.18674729563896,b=0.286321563482228 1672571940000000000
numbers a=-0.26204361353005,b=0.407541855590813 1672572000000000000
numbers a=-0.03704482754523,b=0.307931575430144 1672572060000000000
numbers a=0.313204855879892,b=0.301853194964288 1672572120000000000
numbers a=-0.273494379613843,b=2.00062221009625 1672572180000000000
numbers a=-0.327456153619716,b=0.521366917493004 1672572240000000000
numbers a=0.10582638243224,b=-0.061555643875962 1672572300000000000
numbers a=0.122663554675653,b=-0.882464028168067 1672572360000000000
numbers a=-0.734385429969443,b=-1.65705921874779 1672572420000000000
numbers a=0.682647767197819,b=-0.0273810946874104 1672572480000000000
numbers a=-0.670207227746054,b=0.833940474157421 1672572540000000000
numbers a=-0.84157049946946,b=-1.21043389131531 1672572600000000000
numbers a=-0.695051664486081,b=-1.00897582951074 1672572660000000000
numbers a=0.645116750994659,b=0.478041921311838 1672572720000000000
numbers a=-0.36495831295023,b=-0.389356670634329 1672572780000000000
numbers a=0.496568666689169,b=-2.53095269564579 1672572840000000000
numbers a=0.853589618729087,b=-1.74960165085156 1672572900000000000
numbers a=-0.82953400907249,b=-0.497092605168955 1672572960000000000
numbers a=0.229261368771594,b=0.949401954945307 1672573020000000000
numbers a=0.29216576410892,b=-0.161215836405701 1672573080000000000
numbers a=-0.511965230108869,b=1.8707592320975 1672573140000000000
numbers a=0.229457718839118,b=0.402489767557114 1672573200000000000
numbers a=-0.0260845457529625,b=-1.69073302585846 1672573260000000000
numbers a=0.26313939810636,b=-1.42414830569118 1672573320000000000
numbers a=0.386814694229645,b=0.407999530731044 1672573380000000000
numbers a=-0.127284422087774,b=0.167920887014854 1672573440000000000
numbers a=0.47231934235466,b=-0.253004179022982 1672573500000000000
numbers a=-0.699009482547538,b=0.664093137206441 1672573560000000000
numbers a=-0.11522410655687,b=-0.38384685723373 1672573620000000000
numbers a=0.22872480451848,b=-0.0910777038283652 1672573680000000000
numbers a=0.431010988294264,b=0.854063649726175 1672573740000000000
numbers a=-0.883455911344376,b=-0.376083067103147 1672573800000000000
numbers a=-0.636304796103995,b=0.680362058000002 1672573860000000000
numbers a=0.06528274057116,b=-0.299330721712903 1672573920000000000
numbers a=-0.224022276033057,b=-1.04358430342586 1672573980000000000
numbers a=-0.268437157815189,b=-0.491640074290271 1672574040000000000
numbers a=-0.0768229916255211,b=0.997751629978872 1672574100000000000
numbers a=0.867268262488674,b=-0.24925399233625 1672574160000000000
numbers a=-0.15742315864427,b=-1.0789743179749 1672574220000000000
numbers a=0.0346840328887609,b=2.08695679772298 1672574280000000000
numbers a=0.0646762205153072,b=-1.15343266941045 1672574340000000000
numbers a=-0.143636067483501,b=-0.0950043159630743 1672574400000000000