diff --git a/io/io/inc/ROOT/TBufferMerger.hxx b/io/io/inc/ROOT/TBufferMerger.hxx
index 9440d25d9cad54a0ebe8e382c92768893860d01b..6cc2ff9c3cc25b8ae5ca2f555faea6c9e74abfe1 100644
--- a/io/io/inc/ROOT/TBufferMerger.hxx
+++ b/io/io/inc/ROOT/TBufferMerger.hxx
@@ -110,6 +110,30 @@ public:
       return fMerger.GetNotrees();
    }
 
+   /** Indicates that the temporary keys (corresponding to the object held by the directories
+    *  of the TMemFile) should be compressed or not.   Those object are stored in the TMemFile
+    * (and thus possibly compressed) when a thread push its data forward (by calling
+    * TBufferMergerFile::Write) and the queue is being processed by another.
+    * Once the TMemFile is picked (by any thread to be merged), *after* taking the
+    * TBufferMerger::fMergeMutex, those object are read back (and thus possibly uncompressed)
+    * and then used by merging.
+    * In order word, the compression of those objects/keys is only usefull to reduce the size
+    * in memory (of the TMemFile) and does not affect (at all) the compression factor of the end
+    * result.
+    */
+   void SetCompressTemporaryKeys(Bool_t request_compression = true)
+   {
+      fCompressTemporaryKeys = request_compression;
+   }
+
+   /** Returns whether to compressed the TKey in the TMemFile for the object held by
+    * the TDirectories.  See TBufferMerger::SetCompressTemporaryKeys for more details.
+    */
+   Bool_t GetCompressTemporaryKeys() const
+   {
+      return fCompressTemporaryKeys;
+   }
+
    friend class TBufferMergerFile;
 
 private:
@@ -130,6 +154,7 @@ private:
    void Push(TBufferFile *buffer);
    bool TryMerge(TBufferMergerFile *memfile);
 
+   bool fCompressTemporaryKeys{false};                           //< Enable compression of the TKeys in the TMemFile (save memory at the expense of time, end result is unchanged)
    size_t fAutoSave{0};                                          //< AutoSave only every fAutoSave bytes
    std::atomic<size_t> fBuffered{0};                             //< Number of bytes currently buffered
    TFileMerger fMerger{false, false};                            //< TFileMerger used to merge all buffers
diff --git a/io/io/src/TBufferMerger.cxx b/io/io/src/TBufferMerger.cxx
index 1c083a48d24a07403b274210988728bb9e87980a..e060edfbeb92f64f764e57133704a812e302057b 100644
--- a/io/io/src/TBufferMerger.cxx
+++ b/io/io/src/TBufferMerger.cxx
@@ -131,7 +131,7 @@ void TBufferMerger::MergeImpl()
       queue.pop();
    }
 
-   fMerger.PartialMerge(TFileMerger::kAll | TFileMerger::kIncremental | TFileMerger::kDelayWrite);
+   fMerger.PartialMerge(TFileMerger::kAll | TFileMerger::kIncremental | TFileMerger::kDelayWrite | TFileMerger::kKeepCompression);
    fMerger.Reset();
 }
 
diff --git a/io/io/src/TBufferMergerFile.cxx b/io/io/src/TBufferMergerFile.cxx
index 9c09d081b11622907cff159b62b2fd058e94961a..ce45ba1fe1eb8c12afe3eac68765e0d357a800fd 100644
--- a/io/io/src/TBufferMergerFile.cxx
+++ b/io/io/src/TBufferMergerFile.cxx
@@ -42,7 +42,11 @@ Int_t TBufferMergerFile::Write(const char *name, Int_t opt, Int_t bufsize)
       return 0;
    }
 
+   auto oldCompLevel = GetCompressionLevel();
+   if (!fMerger.GetCompressTemporaryKeys())
+      SetCompressionLevel(0);
    Int_t nbytes = TMemFile::Write(name, opt, bufsize);
+   SetCompressionLevel(oldCompLevel);
 
    if (nbytes) {
       TBufferFile *buffer = new TBufferFile(TBuffer::kWrite, GetSize());