跳转到主要内容
KWDB/SampleDB example project

SampleDB: Quickly validate KWDB capabilities

You can directly run examples for smart meters, multi-model queries, window functions, and aggregate functions to quickly validate KWDB modeling and query capabilities for AIoT scenarios.

sampledb-quickstart
Suggested prompt
Help me try SampleDB in the current environment and explain what each step is doing.
Explain the actions first, then choose an example.
Or run the directory scripts directly.

Four runnable examples

Each example provides scripts for data generation, database and table creation, import, and queries. If KWDB is already deployed in a container, you can start right away.

Start with the smart meter or multi-model query example, then move on to window functions and aggregate functions as needed.

AIoT data modeling

Smart meter model

Organizes relational rdb and time-series tsdb data for a smart meter workload, covering power consumption ranking, faulty meters, alarm detection, load statistics, and recent 24-hour trend queries.

One-command validation script
cd smart-meter && bash smart_meter_test.sh --container <kwdb_container_name>
View directory

Relational + time-series analysis

Multi-model queries

Combines relational and time-series data in one query, showing multi-model statistics, cost estimation fusion, aggregation pushdown, and high-speed multi-model join operators.

One-command validation script
cd multi-mode && bash multi_test.sh --container <kwdb_container_name>
View directory

Grouped window queries

Window functions

Covers COUNT_WINDOW, EVENT_WINDOW, SESSION_WINDOW, STATE_WINDOW, and TIME_WINDOW models for validating time-series event boundaries.

One-command validation script
cd window && bash window_test.sh --container <kwdb_container_name>
View directory

Time-series aggregate operators

Aggregate functions

Covers common aggregate models including COUNT, AVG, SUM, MIN, MAX, STDDEV, FIRST, LAST, TWA, and TIME_BUCKET.

One-command validation script
cd aggregate && bash aggregate_test.sh --container <kwdb_container_name>
View directory
SampleDB multi-model query execution plan diagram
Source: multi-mode example image from KWDB/SampleDB

Validate multi-model capability with real SQL and execution plans

SampleDB does more than provide table structures. It also provides query scripts and execution paths, so you can see how time-series table reads, relational index scans, and multiple join and aggregation operators work together to complete joint analysis.

smart-meter/

Smart meter schemas, data preparation, scenario SQL, and web demo

multi-mode/

Multi-model query scripts, data generation, database import, and query SQL

window/

Window function data generation, table import, and window query examples

aggregate/

Aggregate function data generation, table import, and aggregate query examples