From: Tim Otten <totten@civicrm.org>
Date: Mon, 23 May 2022 21:45:54 +0000 (-0700)
Subject: CRM/Upgrade - Store snapshots with compression. More comments.
X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1564970e27330002832e16414e6951085ca76284;p=civicrm-core.git

CRM/Upgrade - Store snapshots with compression. More comments.
---

diff --git a/CRM/Upgrade/Snapshot.php b/CRM/Upgrade/Snapshot.php
index 56bda5d002..442aed6de1 100644
--- a/CRM/Upgrade/Snapshot.php
+++ b/CRM/Upgrade/Snapshot.php
@@ -119,7 +119,8 @@ class CRM_Upgrade_Snapshot {
         'MIN' => $offset,
         'MAX' => $offset + $pageSize,
       ]);
-      $sqlAction = ($offset === 0) ? "CREATE TABLE {$destTable} AS " : "INSERT INTO {$destTable} ";
+      $sqlAction = ($offset === 0) ? "CREATE TABLE {$destTable} ROW_FORMAT=COMPRESSED AS " : "INSERT INTO {$destTable} ";
+      // Note: 'CREATE TABLE AS' implicitly preserves the character-set of the source-material, so we don't set that explicitly.
       yield new CRM_Queue_Task(
         [static::class, 'insertSnapshotTask'],
         [$sqlAction . $pageSelect->toSQL()],