Documentation

Create a database

Use the influxctl CLI or the Management HTTP API to create a database in your InfluxDB Cloud Dedicated cluster.

Use the influxctl database create command to create a database in your InfluxDB Cloud Dedicated cluster.

  1. If you haven’t already, download and install the influxctl CLI, and then configure an influxctl connection profile for your cluster.

  2. In your terminal, run the influxctl database create command and provide the following:

    • Optional: Database retention period Default is infinite (0).
    • Optional: Database table (measurement) limit. Default is 500.
    • Optional: Database column limit. Default is 250.
    • Optional: InfluxDB tags to use in the partition template. Limit is 7 total tags or tag buckets.
    • Optional: InfluxDB tag buckets to use in the partition template. Limit is 7 total tags or tag buckets.
    • Optional: A Rust strftime date and time string that specifies the time format in the partition template and determines the time interval to partition by. Default is %Y-%m-%d.
    • Database name (see Database naming restrictions)

InfluxDB Cloud Dedicated supports up to 7 total tags or tag buckets in the partition template.

influxctl database create \
  --retention-period 
30d
\
--max-tables
500
\
--max-columns 250 \ --template-tag
TAG_KEY_1
\
--template-tag
TAG_KEY_2
\
--template-tag-bucket
TAG_KEY_3
,
100
\
--template-tag-bucket
TAG_KEY_4
,
300
\
--template-timeformat '%Y-%m-%d' \
DATABASE_NAME

Replace the following in your command:

  • DATABASE_NAME: your InfluxDB Cloud Dedicated database
  • TAG_KEY_1, TAG_KEY_2, TAG_KEY_3, and TAG_KEY_4: tag keys from your data

Database attributes

Retention period syntax (influxctl CLI)

Use the --retention-period flag to define the retention period for the database. The retention period value is a time duration value made up of a numeric value plus a duration unit. For example, 30d means 30 days. A zero duration (0d) retention period is infinite and data won’t expire. The retention period value cannot be negative or contain whitespace.

Valid durations units include

  • m: minute
  • h: hour
  • d: day
  • w: week
  • mo: month
  • y: year

Example retention period values

  • 0d: infinite/none
  • 3d: 3 days
  • 6w: 6 weeks
  • 1mo: 1 month (30 days)
  • 1y: 1 year
  • 30d30d: 60 days
  • 2.5d: 60 hours

Custom partitioning (influxctl CLI)

InfluxDB Cloud Dedicated lets you define a custom partitioning strategy for each database. A partition is a logical grouping of data stored in Apache Parquet format in the InfluxDB v3 storage engine. By default, data is partitioned by day, but, depending on your schema and workload, customizing the partitioning strategy can improve query performance.

Use the --template-tag, --template-tag-bucket, and --template-timeformat flags to define partition template parts used to generate partition keys for the database.

For more information, see Manage data partitioning.

Partition templates can only be applied on create

You can only apply a partition template when creating a database. There is no way to update a partition template on an existing database.

This example uses cURL to send a Management HTTP API request, but you can use any HTTP client.

  1. If you haven’t already, follow the instructions to install cURL for your system.

  2. In your terminal, use cURL to send a request to the following InfluxDB Cloud Dedicated endpoint:

    POST https://console.influxdata.com/api/v0/accounts/ACCOUNT_ID/clusters/CLUSTER_ID/databases

    In the URL, provide the following credentials:

    Provide the following request headers:

    • Accept: application/json to ensure the response body is JSON content
    • Content-Type: application/json to indicate the request body is JSON content
    • Authorization: Bearer and a Management API token for your cluster (see how to create a management token for Management API requests).

    In the request body, provide the following parameters:

    • Optional: Database retention period in nanoseconds. Default is 0 (infinite).
    • Optional: Database table (measurement) limit. Default is 500.
    • Optional: Database column limit. Default is 250.
    • Optional: InfluxDB tags to use in the partition template. Limit is 7 total tags or tag buckets.
    • Optional: InfluxDB tag buckets to use in the partition template. Limit is 7 total tags or tag buckets.
    • Optional: A Rust strftime date and time string that specifies the time format in the partition template and determines the time interval to partition by. Default is %Y-%m-%d.
    • Database name (see Database naming restrictions).

InfluxDB Cloud Dedicated supports up to 7 total tags or tag buckets in the partition template.

The following example shows how to use the Management API to create a database with custom partitioning:

curl \
   --location "https://console.influxdata.com/api/v0/accounts/
ACCOUNT_ID
/clusters/
CLUSTER_ID
/databases"
\
--request POST --header "Accept: application/json" \ --header 'Content-Type: application/json' \ --header "Authorization: Bearer
MANAGEMENT_TOKEN
"
\
--data '{ "name": "'
DATABASE_NAME
'",
"maxTables":
500
,
"maxColumnsPerTable":
250
,
"retentionPeriod":
2592000000000
,
"partitionTemplate": [ { "type": "tag", "value": "
TAG_KEY_1
"
}, { "type": "tag", "value": "
TAG_KEY_2
"
}, { "type": "bucket", "value": { "tagName": "
TAG_KEY_3
",
"numberOfBuckets":
100
} }, { "type": "bucket", "value": { "tagName": "
TAG_KEY_4
",
"numberOfBuckets":
300
} }, { "type": "time", "value": "%Y-%m-%d" } ] }'

Replace the following in your request:

  • ACCOUNT_ID: the ID of the InfluxDB Cloud Dedicated account to create the database for
  • CLUSTER_ID: the ID of the InfluxDB Cloud Dedicated cluster to create the database for
  • MANAGEMENT TOKEN: a management token for your InfluxDB Cloud Dedicated cluster
  • DATABASE_NAME: your InfluxDB Cloud Dedicated database
  • TAG_KEY_1, TAG_KEY_2, TAG_KEY_3, and TAG_KEY_4: tag keys from your data

Database attributes

Retention period syntax (Management API)

Use the retentionPeriod property to specify the retention period for the database. The retention period value is an integer (<int32>) that represents the number of nanoseconds. For example, 2592000000000 means 30 days. A zero (0) retention period is infinite and data won’t expire. The retention period value cannot be negative or contain whitespace.

Example retention period values

  • 0: infinite/none
  • 259200000000000: 3 days
  • 2592000000000000: 30 days
  • 31536000000000000: 1 standard year (365 days)

Custom partitioning (Management API)

InfluxDB Cloud Dedicated lets you define a custom partitioning strategy for each database. A partition is a logical grouping of data stored in Apache Parquet format in the InfluxDB v3 storage engine. By default, data is partitioned by day, but, depending on your schema and workload, customizing the partitioning strategy can improve query performance.

Use the partitionTemplate property to define an array of partition template parts used to generate partition keys for the database.

For more information, see Manage data partitioning.

Partition templates can only be applied on create

You can only apply a partition template when creating a database. There is no way to update a partition template on an existing database.

Database naming restrictions

Database names must adhere to the following naming restrictions:

  • Cannot contain whitespace, punctuation, or special characters. Only alphanumeric, underscore (_), dash (-), and forward-slash (/) characters are permitted.
  • Should not start with an underscore (_).
  • Maximum length of 64 characters.

InfluxQL DBRP naming convention

In InfluxDB 1.x, data is stored in databases and retention policies. In InfluxDB Cloud Dedicated, databases and retention policies have been merged into databases, where databases have a retention period, but retention policies are no longer part of the data model. Because InfluxQL uses the 1.x data model, a database must be mapped to a v1 database and retention policy (DBRP) to be queryable with InfluxQL.

When naming a database that you want to query with InfluxQL, use the following naming convention to automatically map v1 DBRP combinations to an InfluxDB Cloud Dedicated database:

database_name/retention_policy_name

Database naming examples

v1 Database name v1 Retention Policy name New database name
db rp db/rp
telegraf autogen telegraf/autogen
webmetrics 1w-downsampled webmetrics/1w-downsampled

Table and column limits

In InfluxDB Cloud Dedicated, table (measurement) and column limits can be configured using the following options:

Description Default influxctl CLI flag Management API property
Table limit 500 --max-tables maxTables
Column limit 250 --max-columns maxColumnsPerTable

Table limit

Default maximum number of tables: 500

Each measurement is represented by a table in a database. Your database’s table limit can be raised beyond the default limit of 500. InfluxData has production examples of clusters with 20,000+ active tables across multiple databases.

Increasing your table limit affects your InfluxDB Cloud Dedicated cluster in the following ways:

May improve query performance View more info

More PUTs into object storage View more info

More work for the compactor View more info

Column limit

Default maximum number of columns: 250

Time, fields, and tags are each represented by a column in a table. Increasing your column limit affects your InfluxDB Cloud Dedicated cluster in the following ways:

May adversely affect query performance


Was this page helpful?

Thank you for your feedback!


The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Flux is going into maintenance mode and will not be supported in InfluxDB 3.0. This was a decision based on the broad demand for SQL and the continued growth and adoption of InfluxQL. We are continuing to support Flux for users in 1.x and 2.x so you can continue using it with no changes to your code. If you are interested in transitioning to InfluxDB 3.0 and want to future-proof your code, we suggest using InfluxQL.

For information about the future of Flux, see the following: