Update a database
Use the influxctl
CLI
or the Management HTTP API to update attributes such as retention period, column limits, and table limits for a database in your InfluxDB Cloud Dedicated cluster.
Use the influxctl database update
command
to update a database in your InfluxDB Cloud Dedicated cluster.
If you haven’t already, download and install the
influxctl
CLI.In your terminal, run the
influxctl database update
command and provide the following:- Database name
- Optional: Database retention period.
Default is infinite (
0
). - Optional: Database table (measurement) limit.
Default is
500
. - Optional: Database column limit.
Default is
250
.
influxctl database update \
--retention-period 30d \
--max-tables 500 \
--max-columns 250 \
DATABASE_NAME
Replace the following in your command:
DATABASE_NAME
: your InfluxDB Cloud Dedicated database
Database names can’t be updated
The influxctl database update
command uses the database name to identify which
database to apply updates to. The database name itself can’t be updated.
Database attributes
- Retention period syntax
- Database naming restrictions
- InfluxQL DBRP naming convention
- Table and column limits
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 (for example, 0s
or 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/none3d
: 3 days6w
: 6 weeks1mo
: 1 month (30 days)1y
: 1 year30d30d
: 60 days2.5d
: 60 hours
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:
ACCOUNT_ID
: The ID of the account that the cluster belongs to (see how to list cluster details).CLUSTER_ID
: The ID of the cluster that you want to manage (see how to list cluster details).DATABASE_NAME
: The name of the database that you want to delete (see how to list databases).
Provide the following request headers:
Accept: application/json
to ensure the response body is JSON contentContent-Type: application/json
to indicate the request body is JSON contentAuthorization: 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 parameters to update:
- 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
.
Specify the
PATCH
request method.
The following example shows how to use the Management API to update a database:
curl \
--location "https://console.influxdata.com/api/v0/accounts/ACCOUNT_ID/clusters/CLUSTER_ID/databases/DATABASE_NAME" \
--request PATCH \
--header "Accept: application/json" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer MANAGEMENT_TOKEN" \
--data '{
"maxTables": 500,
"maxColumnsPerTable": 250,
"retentionPeriod": 2592000000000000
}'
Replace the following in your request:
ACCOUNT_ID
: the ID of the InfluxDB Cloud Dedicated account to create the database forCLUSTER_ID
: the ID of the InfluxDB Cloud Dedicated cluster to create the database forMANAGEMENT TOKEN
: a management token for your InfluxDB Cloud Dedicated clusterDATABASE_NAME
: your InfluxDB Cloud Dedicated database
Database attributes
- Retention period syntax
- Database naming restrictions
- InfluxQL DBRP naming convention
- Table and column limits
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/none259200000000000
: 3 days2592000000000000
: 30 days31536000000000000
: 1 standard year (365 days)
Database names can’t be updated
The Management API PATCH /api/v0/database
endpoint and
theinfluxctl database update
command use the database name to identify which
database to apply updates to.
The database name itself can’t be updated.
Partition templates can’t be updated
You can only apply a partition template when creating a database. You can’t 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 a 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:
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:
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.