Understanding IoTDB's Alignment Behavior

In Apache IoTDB's tree model, data is organized as independent time series. When you query multiple measurements under the same device (e.g., SELECT temperature, status FROM root.device), IoTDB performs an implicit outer join on the timestamp (aligned by time).

If you delete the temperature value at timestamp 1746410400000, only that specific time-series point is removed. However, the status time-series point at that same timestamp still exists. Because IoTDB aligns the query by time, the timestamp remains visible in the result set, showing null for the deleted temperature and RUNNING for the status.

Depending on your business logic, there are two primary ways to handle this behavior: at the query level or at the data-deletion level.

Solution 1: Use the IS NOT NULL Predicate (Query-Level Fix)

If your application logic considers a row to be an "alarm event" driven primarily by the temperature measurement, filtering out null temperatures is the most standard and efficient approach.

You can modify your query to explicitly filter out rows where the driving measurement is missing:

SELECT temperature, status
FROM root.stof_posts_tree.bad_point.line1.d01
WHERE time >= 1746410400000 
  AND time <= 1746410700000
  AND temperature IS NOT NULL;

Is this performant?

Yes. Apache IoTDB is highly optimized for time-series filtering. When you apply temperature IS NOT NULL, the query engine can quickly skip chunks of data where the temperature column has null values, avoiding unnecessary disk I/O for sibling columns like status.

Solution 2: Delete All Measurements at the Timestamp (Data-Level Fix)

If the entire record at that timestamp is considered "bad" or invalid, deleting only the temperature point leaves stale data (like status) behind. Instead of deleting just the single measurement, you can delete all measurements at that specific timestamp using a wildcard (*):

DELETE FROM root.stof_posts_tree.bad_point.line1.d01.*
WHERE time = 1746410400000;

After executing this, both temperature and status at 1746410400000 are removed. A standard query will no longer return this row because no measurements exist at this timestamp anymore.

Which Pattern Should You Choose?

  • Choose Solution 1 (Query Filtering) if the status at that timestamp is still valid history for other dashboards, but your specific "Alarms Page" only cares about active temperature readings.
  • Choose Solution 2 (Wildcard Deletion) if the entire write at that timestamp was a mistake or corrupted, and you want to completely clean up the database footprint for that point in time.