# Is there a limit on a collection inside a template?

**URL:** <https://forum.canton.network/t/is-there-a-limit-on-a-collection-inside-a-template/7064>\
**Category:** App Development\
**Tags:** daml\
**Created:** [January 23, 2024, 10:56am UTC](https://forum.canton.network/t/is-there-a-limit-on-a-collection-inside-a-template/7064 "2024-01-23T10:56:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cohen.avraham](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@cohen.avraham](https://forum.canton.network/u/cohen.avraham)\
**Post date:** [January 23, 2024, 10:56am UTC](https://forum.canton.network/t/is-there-a-limit-on-a-collection-inside-a-template/7064/1 "2024-01-23T10:56:30Z")

</div>

G-d willing

Hello,  
Is there a limit on the size of a collection I can use inside a template?  
Saying a collection of 100K elements… is that possible?  
And what about updating the contract with 100K elements, how heavy-lifting will it be?

Thanks,

---

<div class="post-metadata">

**Author:** ![Luciano](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/luciano/32/319_2.png) [@Luciano](https://forum.canton.network/u/Luciano)\
**Post date:** [January 24, 2024, 4:20pm UTC](https://forum.canton.network/t/is-there-a-limit-on-a-collection-inside-a-template/7064/2 "2024-01-24T16:20:49Z")

</div>

> [@cohen.avraham](#):
>
> And what about updating the contract with 100K elements, how heavy-lifting will it be?

One thing I know is that there is no structural sharing on the ledger. So if I have a 100k element list on a contract, and I prepend one element to it, it will re-write all 101k values (unlike that same operation in memory).

---

<div class="post-metadata">

**Author:** ![cohen.avraham](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@cohen.avraham](https://forum.canton.network/u/cohen.avraham)\
**Post date:** [January 24, 2024, 4:30pm UTC](https://forum.canton.network/t/is-there-a-limit-on-a-collection-inside-a-template/7064/3 "2024-01-24T16:30:20Z")

</div>

G-d willing

Thanks @Luciano for your reply.  
I am aware to the consequences of adding another element to the collection.  
But, can I assume that when it reaches 200K elements, the application won’t be able to handle it due to memory limit? Generally, I would like to know when this approach is about to fail

---

<div class="post-metadata">

**Author:** ![ali-abrar](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/ali-abrar/32/7038_2.png) [@ali-abrar](https://forum.canton.network/u/ali-abrar)\
**Post date:** [January 25, 2024, 8:49pm UTC](https://forum.canton.network/t/is-there-a-limit-on-a-collection-inside-a-template/7064/4 "2024-01-25T20:49:19Z")

</div>

You might eventually hit transaction size limits, depending on how large each of these elements is. See [Transaction size threshold?](https://discuss.daml.com/t/transaction-size-threshold/6050)
