Skip to content

Explore usage of activerecord-multi-tenant to enforce partitioning key in queries

With table partitioning in mind, we only benefit from it if the partitioning key is being used as a filter in queries.

CitusDB has an interesting gem to automatically use the partitioning key for certain models and based on whatever "tenant" was identified earlier (in our case, tenant equals the partitioning key's value): https://github.com/citusdata/activerecord-multi-tenant

In this issue, we explore the use of this gem and check if this is an option for us. In the best case, we'd be able to automatically defer the top-level namespace from the request and the gem makes sure that any queries on partitioned tables (by top-level namespace in this example) correctly use the partitioning key.