Is there a maximum limit on the number of hashMap key vals in motoko?

Is there a maximum limit on the number of hashMap key vals in motoko? Will excessive hashMaps (such as 1 billion records) affect the write and read speed?

1 Like

May be this will help. You can look into the implementation, how read/write is done, and parent structure of Hashmaps for performance.

There is no artificial limit other than memory size. But the 4 GiB of Wasm memory will run out long before you can reach 1 billion entries. Depending on what you store, I would expect less than 100 M entries in practice, even in the ideal case (i.e., when merely mapping Int to Int).

For a scalable solution, you need to be able to distribute your data over a dynamic number of storage canisters.

3 Likes