Documentation

Design your schema

Schema design can have a significant impact on both write and query performance in your InfluxDB cluster. The items below cover high-level considerations and recommendation. For detailed recommendations, see Schema design recommendations.

Understand the difference between tags and fields

In the InfluxDB data structure, there are three main “categories” of information–timestamps, tags, and fields. Understanding the difference between what should be a tag and what should be a field is important when designing your schema.

Use the following guidelines to determine what should be tags versus fields:

  • Use tags to store metadata that provides information about the source or context of the data.
  • Use fields to store measured values.
  • Field values typically change over time. Tag values do not.
  • Tag values can only be strings.
  • Field values can be any of the following data types:
    • Integer
    • Unsigned integer
    • Float
    • String
    • Boolean

For more information, see Tags versus fields.

Schema restrictions

InfluxDB enforces the following schema restrictions:

  • You cannot use the same name for a tag and a field in the same table.
  • There is a limit to the number of columns you can store in a table. By default, tables can have up to 250 columns.

For more information, see InfluxDB schema restrictions.

Design for performance

The following guidelines help to ensure write and query performance:

Follow the links below for more detailed information.

Design for query simplicity

The following guidelines help to ensure that, when querying data, the schema makes it easy to write queries:

Follow the links below for more detailed information.


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.

Read more

InfluxDB v3 enhancements and InfluxDB Clustered is now generally available

New capabilities, including faster query performance and management tooling advance the InfluxDB v3 product line. InfluxDB Clustered is now generally available.

InfluxDB v3 performance and features

The InfluxDB v3 product line has seen significant enhancements in query performance and has made new management tooling available. These enhancements include an operational dashboard to monitor the health of your InfluxDB cluster, single sign-on (SSO) support in InfluxDB Cloud Dedicated, and new management APIs for tokens and databases.

Learn about the new v3 enhancements


InfluxDB Clustered general availability

InfluxDB Clustered is now generally available and gives you the power of InfluxDB v3 in your self-managed stack.

Talk to us about InfluxDB Clustered