Is there a way to do batch inset operation into a StorageMap without iteration or using a Vec[] type or best workarounds. and if its not whats the reason for not supporting this?

For example there's a method available remove_all()


  • For what are you trying to use batch insertions? Jan 11 at 14:05

1 Answer 1


There is currently no such method. I think it could exist, but it would need some refactor to directly pass a database transaction to the backend. Normally we dont have many batch insertions in a runtime, so it has been not that big of a problem.

Batch operations are a foot-gun for parachains, since they need to pay close attention to their weight consumption. This also applies to remove_all and should always be used with a upper limit to its iteration size.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.