-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Django backend: limit batch size for
bulk_create
operations (#3713)
Postgresql has a `MaxAllocSize` that defaults to 1 GB [1]. If you try to insert more than that in one go (e.g. during import of a large AiiDA export file), you encounter the error: psycopg2.errors.ProgramLimitExceeded: out of memory DETAIL: Cannot enlarge string buffer containing 0 bytes by 1257443654 more bytes. This commit avoids this issue by setting a batch size for `bulk_create` operations. The size of the batch is configurable through the new `db.batch_size` configuration option using `verdi config`. [1] https://github.com/postgres/postgres/blob/master/src/include/utils/memutils.h#L40 max alloc" size
- Loading branch information
Showing
3 changed files
with
83 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters