Skip to main content

KWDB Time-Series Database Tutorial

KWDB is the open source version of KaiwuDB and an open source distributed multi-model database product incubated by OpenAtom Foundation. It provides time-series data processing for AIoT scenarios and is suitable for device metrics, sensor readings, energy curves, connected vehicle status, and operations monitoring data, while allowing SQL queries that join those metrics with relational dimension tables.

How Time-Series Data Is Organized

Time-series data usually contains two kinds of information:

  • Time and values, such as temperature, humidity, voltage, current, position, or status.
  • Tags and dimensions, such as device ID, site, region, model, tenant, or business line.

In KWDB, you can create a time-series database and a tagged time-series table:

CREATE TS DATABASE sensor_data;

CREATE TABLE sensor_data.readings (
ts TIMESTAMPTZ NOT NULL,
temperature FLOAT,
humidity FLOAT
) TAGS (
device_id INT NOT NULL,
location VARCHAR(256) NOT NULL
) PRIMARY TAGS(device_id);

Why Time-Series Data Needs Relational Data

Device readings alone rarely answer the full business question. You also need device names, installation dates, regions, owners, and alert rules. KWDB lets time-series data and relational data work in the same SQL workflow.

The 5-minute quick start shows the full path: create tables, insert data, and run cross-model queries.

Common Query Scenarios

  • Query the latest metric for a device in a time range.
  • Aggregate sensor data by site or region.
  • Join device readings with device profile tables.
  • Analyze energy trends with window functions.
  • Generate inputs for inspection or troubleshooting workflows.

Next Steps