Databases 6 min read

Mastering InfluxDB: Data Types, Schema Design, and Index Configuration

This guide explains InfluxDB’s schemaless data types, best practices for designing tag‑and‑field schemas, and how to choose and configure its in‑memory or TSI indexes, including key parameters such as max‑series‑per‑database and max‑values‑per‑tag for optimal performance.

System Architect Go
System Architect Go
System Architect Go
Mastering InfluxDB: Data Types, Schema Design, and Index Configuration

Data Types

InfluxDB is schemaless; you don't define tables in advance. Supported data types are simple: measurement (string), tag key (string), tag value (string), field key (string), field value (string, float, integer, boolean). Timestamp is always UTC with nanosecond precision.

Data Structure Design

Data is stored in tags or fields. Tags are indexed, improving query performance; fields are not indexed.

Guidelines for choosing tags vs fields:

Data frequently used in query conditions should be tags.

Data intended for GROUP BY should be tags.

Data used with InfluxQL functions should be fields.

Non‑string data should be fields.

Avoid using InfluxQL keywords for identifiers such as database, retention policy, user, measurement, tag key, field key.

Additional principles:

Do not create overly large series; using UUIDs or random strings as tag values can explode series count and memory usage.

Measurement names should not embed actual data; use tags to differentiate.

Keep each tag simple; split complex information into multiple tags to simplify queries and reduce regex usage.

Index Types and Configuration

InfluxDB offers two mutually exclusive index types: in‑memory (default, higher performance) and TSI (Time Series Index) which stores index on disk to support millions to billions of series.

Key configuration parameters (in influxdb.conf) include: index-version = "inmem" In‑memory settings:

max-series-per-database = 1000000
max-values-per-tag = 100000

TSI settings:

max-index-log-file-size = "1m"
series-id-set-cache-size = 100

max-series-per-database limits the number of series per database (default 1 000 000; 0 means unlimited). Exceeding the limit returns a 500 error for new series but does not affect writes to existing series.

max-values-per-tag limits distinct tag values per tag key (default 100 000; 0 means unlimited). Exceeding the limit blocks new tag values but not writes to existing ones.

max-index-log-file-size controls when the write‑ahead log is compacted into an index file; smaller values reduce memory usage but may lower write throughput.

series-id-set-cache-size sets the size of the in‑memory cache for series IDs when using TSI; larger values improve query speed at the cost of more heap memory.

Note: Switching index types requires a restart of InfluxDB.

InfluxDB index diagram
InfluxDB index diagram
IndexingdatabaseConfigurationData ModelingInfluxDBtime series
System Architect Go
Written by

System Architect Go

Programming, architecture, application development, message queues, middleware, databases, containerization, big data, image processing, machine learning, AI, personal growth.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.