active_record_shards
active_record_shards copied to clipboard
Dynamic shards (aka for each account)
Current gem configuration allows to specify a limit number of shards which (as "Usage" section suggest) should be used as buckets for each account (or account-like entity).
In my case I want each account to have a separated database. That will allow to save the disk space in the sharded tables by not including the account_id column in indexes and table itself.
In other words, I want to use the Account#id as a shard_id.
There is no benefit in storing several accounts under the same shard.
Currently this is not possible due to static configurations of the shards that allows to define a limited and static set of shards.
Is there a way to define dynamic shards? Are you interested in the PR?