-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PERFORMANCE] Added index to the experius_page_not_found
This will reduce the load time of a 404 (in a case it was from 3.6s to 329ms)
- Loading branch information
1 parent
f8bf918
commit b72738a
Showing
2 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Experius\PageNotFound\Setup; | ||
|
||
use Magento\Framework\DB\Adapter\AdapterInterface; | ||
use Magento\Framework\Setup\UpgradeSchemaInterface; | ||
use Magento\Framework\Setup\ModuleContextInterface; | ||
use Magento\Framework\Setup\SchemaSetupInterface; | ||
|
||
class UpgradeSchema implements UpgradeSchemaInterface | ||
{ | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function upgrade( | ||
SchemaSetupInterface $setup, | ||
ModuleContextInterface $context | ||
) { | ||
$setup->startSetup(); | ||
if (version_compare($context->getVersion(), "1.0.2", "<")) { | ||
$this->addIndexesToTables($setup); | ||
} | ||
$setup->endSetup(); | ||
} | ||
|
||
public function addIndexesToTables($setup) | ||
{ | ||
$setup->getConnection()->query("ALTER TABLE `{$setup->getTable('experius_page_not_found')}` ADD INDEX `EXPERIUS_PAGE_NOT_FOUND_FROM_URL` (`from_url`(255));"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?xml version="1.0" ?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> | ||
<module name="Experius_PageNotFound" setup_version="1.0.1"/> | ||
<module name="Experius_PageNotFound" setup_version="1.0.2"/> | ||
</config> |