how to change the chunk time interval?
Asked Answered
E

1

6

how can we change the chunk time interval, when it is way too large?

use case:

  • we have an existing hypertable, where we have set the chunk_time_interval to 1 month (when using create_hypertable()).
  • this was fine for the last months, but now the data-rate will be increased by a factor of 1000

e.g. I think we cannot just use set_chunk_time_interval, because it will not affect the current chunk: so when a new month-chunk has just started when the data-rate is increased, this chunk would get huge and only the newer chunks would be right-sized.

So what is the best way to deal with this case?

So to clarify: we want to have one hypertable, where the older data has a different chunk size than the newer data.

Exo answered 16/8, 2019 at 19:19 Comment(1)
I've created a feature request #3472Exo
L
5

We do not currently offer a method of changing the range of an existing chunk, but you can use set_chunk_time_interval to change the next chunk to a (say) day or hour-long period.

One approach if your database isn't too large is just to dump your data (e.g., to CSV), then recreate the database with a different setting. Parallel copy will help with faster loading: https://github.com/timescale/timescaledb-parallel-copy

(Timescale person here)

Lyrism answered 17/8, 2019 at 20:57 Comment(1)
I don't think dump/restore fits my use-case: the existing (old) data has the correct chunk size, only the new data in the table has a different chunk size: or do you mean that I should drop the newest chunk, change the chunk interval and then restore the data of the newest chunk?Exo

© 2022 - 2024 — McMap. All rights reserved.