Skip to main content
The Internet of Things (IoT) describes a trend where computing capabilities are embedded into IoT devices. That is, physical objects, ranging from light bulbs to oil wells. Many IoT devices collect sensor data about their environment and generate time-series datasets with relational metadata. It is often necessary to simulate IoT datasets. For example, when you are testing a new system. This tutorial shows how to simulate a basic dataset in your , and then run simple queries on it. To simulate a more advanced dataset, see Time-series Benchmarking Suite (TSBS).

Prerequisites

To follow the steps on this page:
  • Create a target with Real-time analytics enabled.

    You need your connection details. This procedure also works for .

Simulate a dataset

To simulate a dataset, run the following queries:
  1. Create the sensors table:
  2. Create the sensor_data hypertable
    When you create a using CREATE TABLE … WITH …, the default partitioning column is automatically the first column with a timestamp data type. Also, creates a columnstore policy that automatically converts your data to the , after an interval equal to the value of the chunk_interval, defined through compress_after in the policy. This columnar format enables fast scanning and aggregation, optimizing performance for analytical workloads while also saving significant storage space. In the conversion, s are compressed by up to 98%, and organized for efficient, large-scale queries. You can customize this policy later using alter_job. However, to change after or created_before, the compression settings, or the the policy is acting on, you must remove the columnstore policy and add a new one. You can also manually convert s in a to the .
  3. Populate the sensors table:
  4. Verify that the sensors have been added correctly:
    Sample output:
  5. Generate and insert a dataset for all sensors:
  6. Verify the simulated dataset:
    Sample output:

Run basic queries

After you simulate a dataset, you can run some basic queries on it. For example:
  • Average temperature and CPU by 30-minute windows:
    Sample output:
  • Average and last temperature, average CPU by 30-minute windows:
    Sample output:
  • Query the metadata:
    Sample output:
You have now successfully simulated and run queries on an IoT dataset.