Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions content/enterprise_influxdb/v1/query_language/manage-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ Creates a new database.
#### Syntax

```sql
CREATE DATABASE <database_name> [WITH [DURATION <duration>] [REPLICATION <n>] [SHARD DURATION <duration>] [PAST LIMIT <duration>] [FUTURE LIMIT <duration>] [NAME <retention-policy-name>]]
CREATE DATABASE <database_name> [WITH [DURATION <duration>] [REPLICATION <n>] [SHARD DURATION <duration>] [FUTURE LIMIT <duration>] [PAST LIMIT <duration>] [NAME <retention-policy-name>]]
```

#### Description of syntax

`CREATE DATABASE` requires a database [name](/enterprise_influxdb/v1/troubleshooting/frequently-asked-questions/#what-words-and-characters-should-i-avoid-when-writing-data-to-influxdb).

The `WITH`, `DURATION`, `REPLICATION`, `SHARD DURATION`, `PAST LIMIT`,
`FUTURE LIMIT, and `NAME` clauses are optional and create a single
The `WITH`, `DURATION`, `REPLICATION`, `SHARD DURATION`, `FUTURE LIMIT`,
`PAST LIMIT`, and `NAME` clauses are optional and create a single
[retention policy](/enterprise_influxdb/v1/concepts/glossary/#retention-policy-rp)
associated with the created database.
If you do not specify one of the clauses after `WITH`, the relevant behavior
Expand Down Expand Up @@ -258,7 +258,7 @@ You may disable its auto-creation in the [configuration file](/enterprise_influx
#### Syntax

```sql
CREATE RETENTION POLICY <retention_policy_name> ON <database_name> DURATION <duration> REPLICATION <n> [SHARD DURATION <duration>] [PAST LIMIT <duration>] [FUTURE LIMIT <duration>] [DEFAULT]
CREATE RETENTION POLICY <retention_policy_name> ON <database_name> DURATION <duration> REPLICATION <n> [SHARD DURATION <duration>] [FUTURE LIMIT <duration>] [PAST LIMIT <duration>] [DEFAULT]
```

#### Description of syntax
Expand Down Expand Up @@ -306,27 +306,27 @@ See
[Shard group duration management](/enterprise_influxdb/v1/concepts/schema_and_data_layout/#shard-group-duration-management)
for recommended configurations.

##### `PAST LIMIT` {metadata="v1.12.0+"}
##### `FUTURE LIMIT` {metadata="v1.12.0+"}

The `PAST LIMIT` clause defines a time boundary before and relative to _now_
The `FUTURE LIMIT` clause defines a time boundary after and relative to _now_
in which points written to the retention policy are accepted. If a point has a
timestamp before the specified boundary, the point is rejected and the write
timestamp after the specified boundary, the point is rejected and the write
request returns a partial write error.

For example, if a write request tries to write data to a retention policy with a
`PAST LIMIT 6h` and there are points in the request with timestamps older than
6 hours, those points are rejected.
`FUTURE LIMIT 6h` and there are points in the request with future timestamps
greater than 6 hours from now, those points are rejected.

##### `FUTURE LIMIT` {metadata="v1.12.0+"}
##### `PAST LIMIT` {metadata="v1.12.0+"}

The `FUTURE LIMIT` clause defines a time boundary after and relative to _now_
The `PAST LIMIT` clause defines a time boundary before and relative to _now_
in which points written to the retention policy are accepted. If a point has a
timestamp after the specified boundary, the point is rejected and the write
timestamp before the specified boundary, the point is rejected and the write
request returns a partial write error.

For example, if a write request tries to write data to a retention policy with a
`FUTURE LIMIT 6h` and there are points in the request with future timestamps
greater than 6 hours from now, those points are rejected.
`PAST LIMIT 6h` and there are points in the request with timestamps older than
6 hours, those points are rejected.

##### `DEFAULT`

Expand Down Expand Up @@ -363,14 +363,17 @@ See [Create a database with CREATE DATABASE](/enterprise_influxdb/v1/query_langu

### Modify retention policies with ALTER RETENTION POLICY

The `ALTER RETENTION POLICY` query takes the following form, where you must declare at least one of the retention policy attributes `DURATION`, `REPLICATION`, `SHARD DURATION`, or `DEFAULT`:
The `ALTER RETENTION POLICY` query takes the following form, where you must declare at least one of the retention policy attributes `DURATION`, `REPLICATION`, `SHARD DURATION`, `FUTURE LIMIT`, `PAST LIMIT`, or `DEFAULT`:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's revert this change to keep customers from using limits in ALTER statements

```sql
ALTER RETENTION POLICY <retention_policy_name> ON <database_name> [DURATION <duration>] [REPLICATION <n>] [SHARD DURATION <duration>] [DEFAULT]
ALTER RETENTION POLICY <retention_policy_name> ON <database_name> [DURATION <duration>] [REPLICATION <n>] [SHARD DURATION <duration>] [FUTURE LIMIT <duration>] [PAST LIMIT <duration>] [DEFAULT]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert, as noted above. Perhaps we want to add a note that limits are not changeable (which note we can then remove in 1.12.3).

```

{{% warn %}} Replication factors do not serve a purpose with single node instances.
{{% /warn %}}

For information about the `FUTURE LIMIT` and `PAST LIMIT` clauses, see
[CREATE RETENTION POLICY](#create-retention-policies-with-create-retention-policy).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove for 1.12.2


First, create the retention policy `what_is_time` with a `DURATION` of two days:
```sql
> CREATE RETENTION POLICY "what_is_time" ON "NOAA_water_database" DURATION 2d REPLICATION 1
Expand Down
31 changes: 24 additions & 7 deletions content/enterprise_influxdb/v1/query_language/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@ alter_retention_policy_stmt = "ALTER RETENTION POLICY" policy_name on_clause
retention_policy_option
[ retention_policy_option ]
[ retention_policy_option ]
[ retention_policy_option ]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove for 1.12.2

[ retention_policy_option ]
[ retention_policy_option ] .
```

Expand All @@ -320,6 +322,9 @@ ALTER RETENTION POLICY "1h.cpu" ON "mydb" DEFAULT
-- Change duration and replication factor.
-- REPLICATION (replication factor) not valid for OSS instances.
ALTER RETENTION POLICY "policy1" ON "somedb" DURATION 1h REPLICATION 4

-- Change future and past limits.
ALTER RETENTION POLICY "policy1" ON "somedb" FUTURE LIMIT 6h PAST LIMIT 6h

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove for 1.12.2

```

### CREATE CONTINUOUS QUERY
Expand Down Expand Up @@ -379,13 +384,16 @@ create_database_stmt = "CREATE DATABASE" db_name
[ WITH
[ retention_policy_duration ]
[ retention_policy_replication ]
[ retention_past_limit ]
[ retention_future_limit ]
[ retention_policy_shard_group_duration ]
[ retention_future_limit ]
[ retention_past_limit ]
[ retention_policy_name ]
] .
```

> [!Note]
> When using both `FUTURE LIMIT` and `PAST LIMIT` clauses, `FUTURE LIMIT` must appear before `PAST LIMIT`.

> [!Warning]
> Replication factors do not serve a purpose with single node instances.

Expand All @@ -404,8 +412,8 @@ CREATE DATABASE "bar" WITH DURATION 1d REPLICATION 1 SHARD DURATION 30m NAME "my
CREATE DATABASE "mydb" WITH NAME "myrp"

-- Create a database called bar with a new retention policy named "myrp", and
-- specify the duration, past and future limits, and name of that retention policy
CREATE DATABASE "bar" WITH DURATION 1d PAST LIMIT 6h FUTURE LIMIT 6h NAME "myrp"
-- specify the duration, future and past limits, and name of that retention policy
CREATE DATABASE "bar" WITH DURATION 1d FUTURE LIMIT 6h PAST LIMIT 6h NAME "myrp"
```

### CREATE RETENTION POLICY
Expand All @@ -415,11 +423,14 @@ create_retention_policy_stmt = "CREATE RETENTION POLICY" policy_name on_clause
retention_policy_duration
retention_policy_replication
[ retention_policy_shard_group_duration ]
[ retention_past_limit ]
[ retention_future_limit ]
[ retention_past_limit ]
[ "DEFAULT" ] .
```

> [!Note]
> When using both `FUTURE LIMIT` and `PAST LIMIT` clauses, `FUTURE LIMIT` must appear before `PAST LIMIT`.

> [!Warning]
> Replication factors do not serve a purpose with single node instances.

Expand All @@ -435,8 +446,8 @@ CREATE RETENTION POLICY "10m.events" ON "somedb" DURATION 60m REPLICATION 2 DEFA
-- Create a retention policy and specify the shard group duration.
CREATE RETENTION POLICY "10m.events" ON "somedb" DURATION 60m REPLICATION 2 SHARD DURATION 30m

-- Create a retention policy and specify past and future limits.
CREATE RETENTION POLICY "10m.events" ON "somedb" DURATION 12h PAST LIMIT 6h FUTURE LIMIT 6h
-- Create a retention policy and specify future and past limits.
CREATE RETENTION POLICY "10m.events" ON "somedb" DURATION 12h FUTURE LIMIT 6h PAST LIMIT 6h
```

### CREATE SUBSCRIPTION
Expand Down Expand Up @@ -1332,6 +1343,8 @@ retention_policy = identifier .
retention_policy_option = retention_policy_duration |
retention_policy_replication |
retention_policy_shard_group_duration |
retention_future_limit |
retention_past_limit |
"DEFAULT" .

retention_policy_duration = "DURATION" duration_lit .
Expand All @@ -1340,6 +1353,10 @@ retention_policy_replication = "REPLICATION" int_lit .

retention_policy_shard_group_duration = "SHARD DURATION" duration_lit .

retention_future_limit = "FUTURE LIMIT" duration_lit .

retention_past_limit = "PAST LIMIT" duration_lit .

retention_policy_name = "NAME" identifier .

series_id = int_lit .
Expand Down
35 changes: 19 additions & 16 deletions content/influxdb/v1/query_language/manage-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ Creates a new database.
#### Syntax

```sql
CREATE DATABASE <database_name> [WITH [DURATION <duration>] [REPLICATION <n>] [SHARD DURATION <duration>] [PAST LIMIT <duration>] [FUTURE LIMIT <duration>] [NAME <retention-policy-name>]]
CREATE DATABASE <database_name> [WITH [DURATION <duration>] [REPLICATION <n>] [SHARD DURATION <duration>] [FUTURE LIMIT <duration>] [PAST LIMIT <duration>] [NAME <retention-policy-name>]]
```

#### Description of syntax

`CREATE DATABASE` requires a database [name](/influxdb/v1/troubleshooting/frequently-asked-questions/#what-words-and-characters-should-i-avoid-when-writing-data-to-influxdb).

The `WITH`, `DURATION`, `REPLICATION`, `SHARD DURATION`, `PAST LIMIT`,
`FUTURE LIMIT`, and `NAME` clauses are optional and create a single
The `WITH`, `DURATION`, `REPLICATION`, `SHARD DURATION`, `FUTURE LIMIT`,
`PAST LIMIT`, and `NAME` clauses are optional and create a single
[retention policy](/influxdb/v1/concepts/glossary/#retention-policy-rp)
associated with the created database.
If you do not specify one of the clauses after `WITH`, the relevant behavior
Expand Down Expand Up @@ -259,7 +259,7 @@ You may disable its auto-creation in the [configuration file](/influxdb/v1/admin
#### Syntax

```sql
CREATE RETENTION POLICY <retention_policy_name> ON <database_name> DURATION <duration> REPLICATION <n> [SHARD DURATION <duration>] [PAST LIMIT <duration>] [FUTURE LIMIT <duration>] [DEFAULT]
CREATE RETENTION POLICY <retention_policy_name> ON <database_name> DURATION <duration> REPLICATION <n> [SHARD DURATION <duration>] [FUTURE LIMIT <duration>] [PAST LIMIT <duration>] [DEFAULT]
```

#### Description of syntax
Expand Down Expand Up @@ -307,27 +307,27 @@ See
[Shard group duration management](/influxdb/v1/concepts/schema_and_data_layout/#shard-group-duration-management)
for recommended configurations.

##### `PAST LIMIT` {metadata="v1.12.0+"}
##### `FUTURE LIMIT` {metadata="v1.12.0+"}

The `PAST LIMIT` clause defines a time boundary before and relative to _now_
The `FUTURE LIMIT` clause defines a time boundary after and relative to _now_
in which points written to the retention policy are accepted. If a point has a
timestamp before the specified boundary, the point is rejected and the write
timestamp after the specified boundary, the point is rejected and the write
request returns a partial write error.

For example, if a write request tries to write data to a retention policy with a
`PAST LIMIT 6h` and there are points in the request with timestamps older than
6 hours, those points are rejected.
`FUTURE LIMIT 6h` and there are points in the request with future timestamps
greater than 6 hours from now, those points are rejected.

##### `FUTURE LIMIT` {metadata="v1.12.0+"}
##### `PAST LIMIT` {metadata="v1.12.0+"}

The `FUTURE LIMIT` clause defines a time boundary after and relative to _now_
The `PAST LIMIT` clause defines a time boundary before and relative to _now_
in which points written to the retention policy are accepted. If a point has a
timestamp after the specified boundary, the point is rejected and the write
timestamp before the specified boundary, the point is rejected and the write
request returns a partial write error.

For example, if a write request tries to write data to a retention policy with a
`FUTURE LIMIT 6h` and there are points in the request with future timestamps
greater than 6 hours from now, those points are rejected.
`PAST LIMIT 6h` and there are points in the request with timestamps older than
6 hours, those points are rejected.

##### `DEFAULT`

Expand Down Expand Up @@ -364,14 +364,17 @@ See [Create a database with CREATE DATABASE](/influxdb/v1/query_language/manage-

### Modify retention policies with ALTER RETENTION POLICY

The `ALTER RETENTION POLICY` query takes the following form, where you must declare at least one of the retention policy attributes `DURATION`, `REPLICATION`, `SHARD DURATION`, or `DEFAULT`:
The `ALTER RETENTION POLICY` query takes the following form, where you must declare at least one of the retention policy attributes `DURATION`, `REPLICATION`, `SHARD DURATION`, `FUTURE LIMIT`, `PAST LIMIT`, or `DEFAULT`:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert for 1.12.2

```sql
ALTER RETENTION POLICY <retention_policy_name> ON <database_name> [DURATION <duration>] [REPLICATION <n>] [SHARD DURATION <duration>] [DEFAULT]
ALTER RETENTION POLICY <retention_policy_name> ON <database_name> [DURATION <duration>] [REPLICATION <n>] [SHARD DURATION <duration>] [FUTURE LIMIT <duration>] [PAST LIMIT <duration>] [DEFAULT]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert for 1.12.2

```

{{% warn %}} Replication factors do not serve a purpose with single node instances.
{{% /warn %}}

For information about the `FUTURE LIMIT` and `PAST LIMIT` clauses, see
[CREATE RETENTION POLICY](#create-retention-policies-with-create-retention-policy).

First, create the retention policy `what_is_time` with a `DURATION` of two days:
```sql
> CREATE RETENTION POLICY "what_is_time" ON "NOAA_water_database" DURATION 2d REPLICATION 1
Expand Down
31 changes: 24 additions & 7 deletions content/influxdb/v1/query_language/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ alter_retention_policy_stmt = "ALTER RETENTION POLICY" policy_name on_clause
retention_policy_option
[ retention_policy_option ]
[ retention_policy_option ]
[ retention_policy_option ]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove for 1.12.2

[ retention_policy_option ]
[ retention_policy_option ] .
```

Expand All @@ -318,6 +320,9 @@ ALTER RETENTION POLICY "1h.cpu" ON "mydb" DEFAULT
-- Change duration and replication factor.
-- REPLICATION (replication factor) not valid for OSS instances.
ALTER RETENTION POLICY "policy1" ON "somedb" DURATION 1h REPLICATION 4

-- Change future and past limits.
ALTER RETENTION POLICY "policy1" ON "somedb" FUTURE LIMIT 6h PAST LIMIT 6h

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove for 1.12.2

```

### CREATE CONTINUOUS QUERY
Expand Down Expand Up @@ -378,12 +383,15 @@ create_database_stmt = "CREATE DATABASE" db_name
[ retention_policy_duration ]
[ retention_policy_replication ]
[ retention_policy_shard_group_duration ]
[ retention_past_limit ]
[ retention_future_limit ]
[ retention_past_limit ]
[ retention_policy_name ]
] .
```

> [!Note]
> When using both `FUTURE LIMIT` and `PAST LIMIT` clauses, `FUTURE LIMIT` must appear before `PAST LIMIT`.

> [!Warning]
> Replication factors do not serve a purpose with single node instances.

Expand All @@ -402,8 +410,8 @@ CREATE DATABASE "bar" WITH DURATION 1d REPLICATION 1 SHARD DURATION 30m NAME "my
CREATE DATABASE "mydb" WITH NAME "myrp"

-- Create a database called bar with a new retention policy named "myrp", and
-- specify the duration, past and future limits, and name of that retention policy
CREATE DATABASE "bar" WITH DURATION 1d PAST LIMIT 6h FUTURE LIMIT 6h NAME "myrp"
-- specify the duration, future and past limits, and name of that retention policy
CREATE DATABASE "bar" WITH DURATION 1d FUTURE LIMIT 6h PAST LIMIT 6h NAME "myrp"
```

### CREATE RETENTION POLICY
Expand All @@ -413,11 +421,14 @@ create_retention_policy_stmt = "CREATE RETENTION POLICY" policy_name on_clause
retention_policy_duration
retention_policy_replication
[ retention_policy_shard_group_duration ]
[ retention_past_limit ]
[ retention_future_limit ]
[ retention_past_limit ]
[ "DEFAULT" ] .
```

> [!Note]
> When using both `FUTURE LIMIT` and `PAST LIMIT` clauses, `FUTURE LIMIT` must appear before `PAST LIMIT`.

> [!Warning]
> Replication factors do not serve a purpose with single node instances.

Expand All @@ -433,8 +444,8 @@ CREATE RETENTION POLICY "10m.events" ON "somedb" DURATION 60m REPLICATION 2 DEFA
-- Create a retention policy and specify the shard group duration.
CREATE RETENTION POLICY "10m.events" ON "somedb" DURATION 60m REPLICATION 2 SHARD DURATION 30m

-- Create a retention policy and specify past and future limits.
CREATE RETENTION POLICY "10m.events" ON "somedb" DURATION 12h PAST LIMIT 6h FUTURE LIMIT 6h
-- Create a retention policy and specify future and past limits.
CREATE RETENTION POLICY "10m.events" ON "somedb" DURATION 12h FUTURE LIMIT 6h PAST LIMIT 6h
```

### CREATE SUBSCRIPTION
Expand Down Expand Up @@ -1321,6 +1332,8 @@ retention_policy = identifier .
retention_policy_option = retention_policy_duration |
retention_policy_replication |
retention_policy_shard_group_duration |
retention_future_limit |
retention_past_limit |
"DEFAULT" .

retention_policy_duration = "DURATION" duration_lit .
Expand All @@ -1329,6 +1342,10 @@ retention_policy_replication = "REPLICATION" int_lit .

retention_policy_shard_group_duration = "SHARD DURATION" duration_lit .

retention_future_limit = "FUTURE LIMIT" duration_lit .

retention_past_limit = "PAST LIMIT" duration_lit .

retention_policy_name = "NAME" identifier .

series_id = int_lit .
Expand Down Expand Up @@ -1458,7 +1475,7 @@ iterator.

### Built-in iterators

There are many helper iterators that let us build queries:
InfluxDB provides 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
Expand Down
Loading