From f7255598c391487a96a382a50888f6bbc979458d Mon Sep 17 00:00:00 2001 From: Anatoly Date: Thu, 9 Apr 2020 01:48:53 +0300 Subject: [PATCH] avoid vacuum after copy as it is irrelevant --- README.md | 2 +- .../FromMySqlToPostgreSql.php | 52 ++----------------- 2 files changed, 4 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 066004d..ad96ca0 100755 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ However, if you're not into Node.js, you can still use old and proven FromMySqlT anatolyuss@gmail.com

VERSION

-

Current version is 1.4.2
+

Current version is 1.5.0
(major version . improvements . bug fixes)

TESTING

diff --git a/migration/FromMySqlToPostgreSql/FromMySqlToPostgreSql.php b/migration/FromMySqlToPostgreSql/FromMySqlToPostgreSql.php index acfef64..6fbc0ea 100755 --- a/migration/FromMySqlToPostgreSql/FromMySqlToPostgreSql.php +++ b/migration/FromMySqlToPostgreSql/FromMySqlToPostgreSql.php @@ -1369,51 +1369,6 @@ private function processForeignKey($strTableName) } } - /** - * Runs "vacuum full" and "ANALYZE" for given table. - * - * @param string $strTableName - * @return void - */ - private function runVacuumFullAndAnalyze($strTableName) - { - $sql = ''; - - $this->log( - "\t" . '-- Running "VACUUM FULL and ANALYZE" query for table "' - . $this->strSchema . '"."' . $strTableName . '"...' . PHP_EOL - ); - - try { - $this->connect(); - $sql = 'VACUUM (FULL, ANALYZE) "' . $this->strSchema . '"."' . $strTableName . '";'; - $stmt = $this->pgsql->query($sql); - - if (false === $stmt) { - $this->log( - "\t" . '-- Failed when run "VACUUM FULL and ANALYZE" query for table "' - . $this->strSchema . '"."' . $strTableName . '"...' . PHP_EOL - ); - - } else { - $this->log( - "\t" . '-- "VACUUM FULL and ANALYZE" procedure for table "' - . $this->strSchema . '"."' . $strTableName . '" has been successfully accomplished...' . PHP_EOL - ); - } - - unset($stmt, $sql); - - } catch (\PDOException $e) { - $strMsg = __METHOD__ . PHP_EOL . "\t" - . '-- Error occurred when tried to run "VACUUM FULL and ANALYZE" query for table "' - . $this->strSchema . '"."' . $strTableName . '"...' . PHP_EOL; - - $this->generateError($e, $strMsg, $sql); - unset($strMsg); - } - } - /** * Set constraints (excluding foreign key constraints) for given table. * @@ -1571,13 +1526,12 @@ private function createConstraints() } /** - * Set foreign key constraints, then run "vacuum full" and "ANALYZE" for each table. + * Set foreign key constraints. */ - private function createForeignKeysAndRunVacuumFullAndAnalyze() + private function createForeignKeys() { foreach ($this->arrTablesToMigrate as $arrTable) { $this->processForeignKey($arrTable['Tables_in_' . $this->strMySqlDbName]); - $this->runVacuumFullAndAnalyze($arrTable['Tables_in_' . $this->strMySqlDbName]); unset($arrTable); } } @@ -1637,7 +1591,7 @@ public function migrate() if (!$this->isDataOnly) { $this->createConstraints(); - $this->createForeignKeysAndRunVacuumFullAndAnalyze(); + $this->createForeignKeys(); $this->createViews(); }