Interval type for add_tiering_policy

Is there documentation on what the interval type is for add_tiering_policy()? For instance with

SELECT add_tiering_policy('example_table', move_after => 180 )

What interval would 180 be? Is that in days? Hours? Seconds?

Hi @justuswitmer , this is a data interval. As your hypertable can also have dimentions that are not a timestamp, it can also recognize and allow you to use such integers for facilitating.

By default, use interval:

SELECT add_tiering_policy('example', INTERVAL '3 days');

If you place just '3 days' it will also cast the data to interval accordingly with the dimension type.

So that’s what I thought as well. However, when I do that I get this error: Type mismatch for move_after parameter : expected type = Integer
But when I run this: SELECT add_tiering_policy('example', 180);, then it’s successful. So can I set a policy using this syntax? I don’t have a timestamp column, but instead have a unixtime column with the type integer.

Hi @jonatasdp, any thoughts on my above question?

Hi @justuswitmer, Yes! You can cast your interval to a unix epoch and make it compatible based on the same measurement unit.

Following up, I created an issue for docs team to update the documentation and make examples with unix time.

1 Like