postgreSQL-12: Is there a way to enable FIFO to limit database table storage capacity?

116 views Asked by At

I have a ThingsBoard PE setup using AWS EC2 instance, with postgreSQL-12 as the database.

There is a table ts_kv_2020_10 which stores all telemetry data for the month of October.

ts_kv_2020_10

Is there a way I can enable FIFO on this ts_kv_2020_10 table to keep storage at a fixed capacity of example 1GB? (i.e. When limit is reached, data that was first stored onto the table will automatically be replaced by the lastest incoming data.)

1

There are 1 answers

0
AudioBubble On

No, there is no built-in feature in Postgres for that.

You will either need to roll your own (e.g. using triggers) or use partitioning to get rid of an entire month once it's not needed any longer.