How to segregate client data in a Hypertable, on client id

I have a few tables using timescaledb that hold some millions of rows. There is a column called client_tag which I would like to partition on in addition to the time-series partitioning. There are two reasons for this: improved performance, AND being able to comply with some tenancy requirement of storing different clients’ data in different tables.

I’ve seen that additional partitioning dimensions can be added to tables, but that it uses hash partitioning. This wouldn’t meet the second requirement. I’ve seen something about how custom partitioning functions can be written, which I imagine is what I would need.

I have a few questions about this:

  • Is there more documentation about the custom partitioning functions?
  • With custom partitioning functions, does the number of partitions need to be set ahead of time? Could I set it to more partitions than our current number of clients, so that there is room to grow with one client per partition?
  • Can this partitioning be applied to an existing table that has lots of data?

Thanks! :slight_smile: