Protocol Format
The InfluxDB Line Protocol follows this structure:Components
The name of the table (measurement) where data will be written. If the table does not exist and auto-create is enabled, QuestDB creates it automatically.
Optional metadata stored as SYMBOL columns. Tags are indexed and optimized for filtering. Multiple tags are comma-separated with no spaces.
Data values stored in the table. At least one field is required. Multiple fields are comma-separated. Fields are separated from tags by a space character.
Optional timestamp value. If omitted, QuestDB uses the server time. The timestamp unit is specified by a suffix or server configuration.
Data Types
QuestDB supports the following field value types:Numeric value without suffix (e.g.,
42.5, 3.14). Stored as DOUBLE by default.Numeric value with
i suffix (e.g., 42i, 1000i). Stored as LONG by default.Quoted text value (e.g.,
"hello world", "status: OK").Boolean value:
t, T, true, True, TRUE for true; f, F, false, False, FALSE for false.High-precision numeric value with
d suffix (e.g., 123.456789d). Stored as DECIMAL256.Integer with timestamp unit suffix:
n (nanos), t (micros), m (millis).Hexadecimal value with
0x prefix and i suffix (e.g., 0x1234567890abcdefi).Timestamp Precision
QuestDB supports multiple timestamp units:| Suffix | Unit | Example | Description |
|---|---|---|---|
n | Nanoseconds | 1609459200000000000n | Highest precision |
t | Microseconds | 1609459200000000t | Default for ILP/TCP |
m | Milliseconds | 1609459200000m | Common for web APIs |
| (none) | Nanoseconds | 1609459200000000000 | Server default |
Examples
Escaping Special Characters
Special characters must be escaped with a backslash (\):
- In table names and tag keys/values: Escape commas (
,), equals (=), and spaces () - In field keys: Escape commas (
,), equals (=), and spaces () - In field string values: Use double quotes and escape internal quotes with backslash
Examples
Complete Examples
Basic Measurement
sensors with:
- Tags:
location(london),sensor_id(sensor_001) - Fields:
temperature(23.5),humidity(65.2) - Timestamp: 1609459200000000000 nanoseconds
Multiple Data Types
Batch Ingestion
Ingestion Methods
QuestDB supports ILP ingestion over:- TCP - Recommended for production use. Supports authentication, high throughput, and connection pooling. Default port: 9009
- UDP - Fire-and-forget ingestion with no acknowledgment. Lower overhead but no delivery guarantees. Default port: 4567
Best Practices
Use TCP for production workloads where data delivery is critical. TCP provides authentication, error handling, and connection management.
Performance Considerations
- Batch writes - Send multiple lines per connection for better throughput
- Timestamp ordering - Send data in timestamp order when possible to optimize partition writes
- Column types - QuestDB infers column types from the first value. Explicit type suffixes prevent type mismatches
- Tag cardinality - Keep tag value cardinality reasonable (thousands, not millions) for optimal performance
- Connection pooling - Reuse TCP connections across multiple writes to reduce connection overhead
Configuration
ILP behavior is controlled by server configuration properties:- Auto-create tables - Automatically create tables from ILP messages (default: enabled)
- Auto-create columns - Automatically add new columns to existing tables (default: enabled)
- Default partition - Default partitioning strategy for new tables (default: DAY)
- Timestamp unit - Default timestamp unit when no suffix is provided (default: nanoseconds)
- Commit interval - How frequently to commit data to disk (default: 2000ms)