From e49a8e1c6f574d854ed37dc3247a4f2e68920444 Mon Sep 17 00:00:00 2001 From: Twice Date: Sat, 13 Jul 2024 17:47:01 +0900 Subject: [PATCH] perf(conn): skip index matching when index map is empty (#2405) --- src/server/redis_connection.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/server/redis_connection.cc b/src/server/redis_connection.cc index 0457c71d57e..b8985f60812 100644 --- a/src/server/redis_connection.cc +++ b/src/server/redis_connection.cc @@ -544,7 +544,8 @@ void Connection::ExecuteCommands(std::deque *to_process_cmds) { // TODO: transaction support for index recording std::vector index_records; - if (IsHashOrJsonCommand(cmd_name) && (attributes->flags & redis::kCmdWrite) && !config->cluster_enabled) { + if (!srv_->index_mgr.index_map.empty() && IsHashOrJsonCommand(cmd_name) && (attributes->flags & redis::kCmdWrite) && + !config->cluster_enabled) { attributes->ForEachKeyRange( [&, this](const std::vector &args, const CommandKeyRange &key_range) { key_range.ForEachKey(