Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chunk size patch #3624

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions store/postgres/src/relational.rs
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,8 @@ impl Layout {
// Each operation must respect the maximum number of bindings allowed in PostgreSQL queries,
// so we need to act in chunks whose size is defined by the number of entities times the
// number of attributes each entity type has.
// We add 1 to account for the `block_range` bind parameter
let chunk_size = POSTGRES_MAX_PARAMETERS / (table.columns.len() + 1);
// We add 2 to account for the `block_range` and 'vid' bind parameters
let chunk_size = POSTGRES_MAX_PARAMETERS / (table.columns.len() + 2);
for chunk in entities.chunks_mut(chunk_size) {
count += InsertQuery::new(table, chunk, block)?
.get_results(conn)
Expand Down Expand Up @@ -794,8 +794,8 @@ impl Layout {
// Each operation must respect the maximum number of bindings allowed in PostgreSQL queries,
// so we need to act in chunks whose size is defined by the number of entities times the
// number of attributes each entity type has.
// We add 1 to account for the `block_range` bind parameter
let chunk_size = POSTGRES_MAX_PARAMETERS / (table.columns.len() + 1);
// We add 2 to account for the `block_range` and 'vid' bind parameters
let chunk_size = POSTGRES_MAX_PARAMETERS / (table.columns.len() + 2);
for chunk in entities.chunks_mut(chunk_size) {
count += InsertQuery::new(table, chunk, block)?.execute(conn)?;
}
Expand Down