From 4989e1a9f741cf4436c27587696967a15b9a8e59 Mon Sep 17 00:00:00 2001 From: Jannis Tsiroyannis Date: Fri, 31 Jan 2025 10:51:27 +0100 Subject: [PATCH] Getting dependency-data should not need to hold the whole dataset in memory twice. --- importers/src/main/groovy/whelk/importer/DatasetImporter.groovy | 1 + .../src/main/groovy/whelk/component/PostgreSQLComponent.groovy | 2 ++ 2 files changed, 3 insertions(+) diff --git a/importers/src/main/groovy/whelk/importer/DatasetImporter.groovy b/importers/src/main/groovy/whelk/importer/DatasetImporter.groovy index 708a3daf95..194274dedf 100644 --- a/importers/src/main/groovy/whelk/importer/DatasetImporter.groovy +++ b/importers/src/main/groovy/whelk/importer/DatasetImporter.groovy @@ -448,6 +448,7 @@ class DatasetImporter { private boolean remove(String id, boolean force) { try { + log.info("Removing " + id + " from dataset") whelk.remove(id, "xl", null, force) return true } catch ( RuntimeException re ) { diff --git a/whelk-core/src/main/groovy/whelk/component/PostgreSQLComponent.groovy b/whelk-core/src/main/groovy/whelk/component/PostgreSQLComponent.groovy index 3d82a63906..ae02e901ea 100644 --- a/whelk-core/src/main/groovy/whelk/component/PostgreSQLComponent.groovy +++ b/whelk-core/src/main/groovy/whelk/component/PostgreSQLComponent.groovy @@ -2208,7 +2208,9 @@ class PostgreSQLComponent { String replacement = "'" + excludeRelations.join("', '") + "'" query = query.replace("€", replacement) + connection.setAutoCommit(false) preparedStatement = connection.prepareStatement(query) + preparedStatement.setFetchSize(256) preparedStatement.setString(1, id) rs = preparedStatement.executeQuery() List> dependencies = []