# How does auto partitioning work?

**URL:** <https://forum.datomic.com/t/how-does-auto-partitioning-work/1593>\
**Category:** Datomic Cloud\
**Created:** [August 21, 2020, 7:30am UTC](https://forum.datomic.com/t/how-does-auto-partitioning-work/1593 "2020-08-21T07:30:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxweber](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@maxweber](https://forum.datomic.com/u/maxweber)\
**Post date:** [August 21, 2020, 7:30am UTC](https://forum.datomic.com/t/how-does-auto-partitioning-work/1593/1 "2020-08-21T07:30:39Z")

</div>

Hi,

I’m wondering how auto partitioning work and how it is superior to the on-prem partitioning?

The [documentation](https://docs.datomic.com/on-prem/moving-to-cloud.html#partitioning) says:

> This makes client drivers and client programs easier to write and use, and it eliminates partition control as a user-space concern.

Understood, but would auto partitioning also help to support [multi-tenancy](https://forum.datomic.com/t/multi-tenancy-databases/238)?

Best regards,

Max

---

<div class="post-metadata">

**Author:** ![jaret](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.datomic.com/jaret/32/45_2.png) [@jaret](https://forum.datomic.com/u/jaret)\
**Post date:** [August 27, 2020, 5:12pm UTC](https://forum.datomic.com/t/how-does-auto-partitioning-work/1593/2 "2020-08-27T17:12:02Z")

</div>

Hi @Maxweber,

> Understood, but would auto partitioning also help to support [multi-tenancy](https://forum.datomic.com/t/multi-tenancy-databases/238)

In Datomic Cloud partitioning _is_ automatic and it does help support multi-tenancy. The current partitioning automatically distributes across partitons in a DB. The point here is that you do not need to determine a partitioning strategy when using Cloud and Cloud supports multi-tenancy.

Thanks,  
Jaret

---

<div class="post-metadata">

**Author:** ![maxweber](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@maxweber](https://forum.datomic.com/u/maxweber)\
**Post date:** [September 3, 2020, 7:24am UTC](https://forum.datomic.com/t/how-does-auto-partitioning-work/1593/3 "2020-09-03T07:24:48Z")

</div>

Hi @jaret,

thanks a lot for your answer. Good to hear that Datomic Cloud was also optimized for multi-tenancy.

May you tell us more about, how Datomic chooses the partition for an entity? We use an attribute `:entity/owner` to store a ref to the owner entity. Ideally all entities of an owner should end up in the same partition. At the moment we have performance issues with On-Prem Datomic, since we do not use partitioning yet and the peer needs to fetch too many segments from the cold storage, when a customer returns after several hours of inactivity. A migration to On-Prem partitioning would be very difficult for us, since all entity ids would change.

Best regards,

Max

---

<div class="post-metadata">

**Author:** ![adamharris](https://avatars.discourse-cdn.com/v4/letter/a/53a042/32.png) [@adamharris](https://forum.datomic.com/u/adamharris)\
**Post date:** [February 21, 2022, 4:55pm UTC](https://forum.datomic.com/t/how-does-auto-partitioning-work/1593/4 "2022-02-21T16:55:52Z")

</div>

Hi @jaret,

Following up on Max’s question above, can you please give some more details (or point me in the right direction to some docs) as to how Datomic Cloud determines a partition for an entity?

We’re interested in multi-tenancy but can’t find enough up to date information about how Datomic Cloud does partitioning to enable us to architect our multi-tenant system with Datomic Cloud.

Many thanks,  
Adam

---

<div class="post-metadata">

**Author:** ![jaret](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.datomic.com/jaret/32/45_2.png) [@jaret](https://forum.datomic.com/u/jaret)\
**Post date:** [February 23, 2022, 4:45pm UTC](https://forum.datomic.com/t/how-does-auto-partitioning-work/1593/5 "2022-02-23T16:45:45Z")

</div>

@adamharris We don’t currently document Datomic cloud’s partitioning strategy, but maybe we could (I need to talk with dev on that). Can you share with me how you plan to use it to support multi-tenancy?

Thanks!
