SHOW TABLE STATUS patch - Magento 2
How to install our isTableExists()
patch for MySQL
INFO: The patch below is already included since version Magento 2.4.2.
If you are running an online shop with an earlier version of Magento, there are several methods to install our performance patch for MySQL. For a safe installation of the update we recommend the installation via Composer.
Composer method
For the installation via Composer, the file composer-fasterisTableExists.diff.gz must be downloaded and unpacked inside the Magento root directory into the folder patches/composer
. If this folder does not exist yet, please create it beforehand..
This is possible via SSH with the following commands:
cd <MagentoStammverzeichnis>
mkdir -p patches/composer
curl https://maxcluster.de/knowledge-base/downloads/fasteristableexists/composer-fasterisTableExists.diff.gz > patches/composer/fasterisTableExists.diff.gz
gunzip patches/composer/fasterisTableExists.diff.gz
In order to install patches via Composer, you need the cweagans/composer-patches
tool, which can be installed with the following command:
composer require cweagans/composer-patches
In the next step, extend the extra section of composer.json
to install the patch. For this, please add the following:
...
"extra": {
...
"composer-exit-on-patch-failure": true,
"patches": {
"magento/framework": {
"fasterisTableExists": "patches/composer/fasterisTableExists.diff"
}
}
}
If you use a build pipeline or manage the composer.json
in an external repository, please make sure that the composer.json
is also adapted there, so that the patch is also applied in future deployments.
The patch can now be installed with the following command:
composer -v install
The output should confirm that the vendor/magento/framework/DB/Adapter/Pdo/Mysql.php
has been modified.
The output usually looks like this:
Gathering patches for root package.
Removing package magento/framework so that it can be re-installed and re-patched.
- Removing magento/framework (102.0.5)
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies.
It is recommended that you run `composer update` or `composer update <package name>`.
Dependency resolution completed in 0.026 seconds
Analyzed 1049 packages to resolve dependencies
Analyzed 6937 rules to resolve dependencies
Package operations: 1 install, 0 updates, 0 removals
Installs: magento/framework:102.0.5
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
Found 1 patches for magento/framework.
- Installing magento/framework (102.0.5): Loading from cache
Extracting archive - Applying patches for magento/framework
patches/composer/fasterisTableExists.diff (fasterisTableExists)
patch '-p1' --no-backup-if-mismatch -d '/var/www/share/magento2-demoshop-maxcluster.de/2.3.5-p1/vendor/magento/framework' < '/var/www/share/magento2-demoshop-maxcluster.de/2.3.5-p1/patches/composer/fasterisTableExists.diff'
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- DB/Adapter/Pdo/Mysql.php 2020-06-04 17:19:28.439003997 +0200
|+++ DB/Adapter/Pdo/Mysql.php 2020-06-04 17:19:45.295945396 +0200
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
3 out of 3 hunks ignored
patch '-p0' --no-backup-if-mismatch -d '/var/www/share/magento2-demoshop-maxcluster.de/2.3.5-p1/vendor/magento/framework' < '/var/www/share/magento2-demoshop-maxcluster.de/2.3.5-p1/patches/composer/fasterisTableExists.diff'
patching file DB/Adapter/Pdo/Mysql.php
Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead.
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
35 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Running PHPCodeSniffer Composer Installer
PHP CodeSniffer Config installed_paths set to ../../magento/magento-coding-standard,../../phpcompatibility/php-compatibility,../../codeception
Using config file: /var/www/share/magento2-demoshop-maxcluster.de/2.3.5-p1/vendor/squizlabs/php_codesniffer/CodeSniffer.conf
Config value "installed_paths" updated successfully; old value was "../../codeception,../../magento/magento-coding-standard,../../phpcompatibility/php-compatibility"
Note: The message "can't find file to patch at input line 3" is normal and does not prevent the correct installation of the patch.
Finally, the composer.lock
file must be updated, which can be done with the following command:
composer update --lock
Please note that this file must also be transferred to the version management if required.
Please also remember to remove the patch from composer.json
again when updating to Magento 2.4.2.
Patch method
Alternatively to the method via Composer, it is also possible to install the patch directly.
For this, the patch can be downloaded from the Magento root directory with the following command:
wget https://maxcluster.de/knowledge-base/downloads/fasteristableexists/fasterisTableExists.diff.gz
gunzip fasterisTableExists.diff.gz
It is then installed with this command:
patch -p0 < fasterisTableExists.diff
After the patch installation you can remove the fasterisTableExists.diff
file again. Please note that this procedure must be repeated after each Magento update.
You have questions about the installation?
As usual, our support is available 24/7/365. Just call or email us, we will get back to you as soon as possible!