Search code examples
databasestreamingdistributed-systemreal-time-datadolphindb

How DolphinDB clears historical data from distributed tables?


I am using DolphinDB to store real-time metrics generated by factory device. There are 1000 devices, each device generates 3000 metrics per second. I've build a distributed database in DolphinDB to store and analyze these data:

db1 = database (, VALUE, 2013.01.01... 2018.12.31)
db2 = database (, RANGE, 1000* (1.10))
db = database ("dfs://DevMetricsDB", COMPO, [db1, db2])
db.createPartitionedTable(t, "metricsTb", `timestamp` devId)

Since the server disk capacity is not enough to store data for more than a month, I am going to do a scheduled task to backup and delete data from the current database a month ago. I found that DolphinDB distributed tables do not support 'delete' data. What should I do? Can DolphinDB do this? Or do I need shell scripts to do this?


Solution

  • Please use function dropPartition to delete historical data.

    db = database ("dfs://DevMetricsDB")
    start = today() - 40
    end = today() - 30
    dropPartition(db, start..end)