From 09a38b10a9e282a508b375f7856ce5b5257a2df5 Mon Sep 17 00:00:00 2001 From: Hannah Bast Date: Thu, 15 Jan 2026 22:03:35 +0100 Subject: [PATCH] Add runtime parameter `disable-update-graph-metadata` The parameter does what it says, and is `false` by default --- src/global/RuntimeParameters.cpp | 1 + src/global/RuntimeParameters.h | 4 ++++ src/index/LocatedTriples.cpp | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/src/global/RuntimeParameters.cpp b/src/global/RuntimeParameters.cpp index 5a409a2c32..b23b79a4c4 100644 --- a/src/global/RuntimeParameters.cpp +++ b/src/global/RuntimeParameters.cpp @@ -51,6 +51,7 @@ RuntimeParameters::RuntimeParameters() { add(materializedViewWriterMemory_); add(defaultQueryTimeout_); add(sortInMemoryThreshold_); + add(disableUpdateGraphMetadata_); defaultQueryTimeout_.setParameterConstraint( [](std::chrono::seconds value, std::string_view parameterName) { diff --git a/src/global/RuntimeParameters.h b/src/global/RuntimeParameters.h index 67cdfbf3f8..24901addfe 100644 --- a/src/global/RuntimeParameters.h +++ b/src/global/RuntimeParameters.h @@ -135,6 +135,10 @@ struct RuntimeParameters { MemorySizeParameter sortInMemoryThreshold_{ ad_utility::MemorySize::gigabytes(5), "sort-in-memory-threshold"}; + // If set to `true`, skip updating graph metadata for delta triples. + // This can improve performance when graph metadata is not needed. + Bool disableUpdateGraphMetadata_{false, "disable-update-graph-metadata"}; + // ___________________________________________________________________________ // IMPORTANT NOTE: IF YOU ADD PARAMETERS ABOVE, ALSO REGISTER THEM IN THE // CONSTRUCTOR, S.T. THEY CAN ALSO BE ACCESSED VIA THE RUNTIME INTERFACE. diff --git a/src/index/LocatedTriples.cpp b/src/index/LocatedTriples.cpp index 4666d856ff..4d61f5f903 100644 --- a/src/index/LocatedTriples.cpp +++ b/src/index/LocatedTriples.cpp @@ -11,6 +11,7 @@ #include "index/LocatedTriples.h" #include "backports/algorithm.h" +#include "global/RuntimeParameters.h" #include "index/CompressedRelation.h" #include "index/ConstantsIndexBuilding.h" #include "util/ChunkedForLoop.h" @@ -276,6 +277,11 @@ void LocatedTriplesPerBlock::setOriginalMetadata( // the graph info is set to `nullopt`, which means that there is no info. static auto updateGraphMetadata(CompressedBlockMetadata& blockMetadata, const LocatedTriples& locatedTriples) { + // Early return if graph metadata updates are disabled. + if (getRuntimeParameter<&RuntimeParameters::disableUpdateGraphMetadata_>()) { + return; + } + // We do not know anything about the triples contained in the block, so we // also cannot know if the `locatedTriples` introduces duplicates. We thus // have to be conservative and assume that there are duplicates.