From b886119ca75e8f30d4a38ba4ef159285f1a3e0a3 Mon Sep 17 00:00:00 2001 From: Ilya Date: Mon, 6 Jun 2022 02:42:31 +0300 Subject: [PATCH 1/2] change postgres chunk size calculations --- store/postgres/src/relational.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/store/postgres/src/relational.rs b/store/postgres/src/relational.rs index 47951b7c417..ebd29497cf0 100644 --- a/store/postgres/src/relational.rs +++ b/store/postgres/src/relational.rs @@ -648,7 +648,7 @@ impl Layout { // 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); + 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) @@ -795,7 +795,7 @@ impl Layout { // 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); + 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)?; } From fd92002debe849b2489150523c662fd5d93a6f98 Mon Sep 17 00:00:00 2001 From: Ilya Date: Mon, 6 Jun 2022 03:02:15 +0300 Subject: [PATCH 2/2] change comment --- store/postgres/src/relational.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/store/postgres/src/relational.rs b/store/postgres/src/relational.rs index ebd29497cf0..f4e79cb3c9b 100644 --- a/store/postgres/src/relational.rs +++ b/store/postgres/src/relational.rs @@ -647,7 +647,7 @@ 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 + // 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)? @@ -794,7 +794,7 @@ 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 + // 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)?;