41 votes
Accepted

Mage::getBaseUrl() vs Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)

First look at getBaseUrl() at Mage.php public static function getBaseUrl($type = Mage_Core_Model_Store::URL_TYPE_LINK, $secure = null) { return self::app()->getStore()->getBaseUrl($...
user avatar
  • 75.4k
38 votes

How to log all Magento 2 SQL queries?

bin/magento dev:query-log:enable . (copied my answer from Magento 2 log database queries)
user avatar
  • 829
37 votes
Accepted

How to log all Magento 2 SQL queries?

In your app/etc/di.xml, replace the line: <preference for="Magento\Framework\DB\LoggerInterface" type="Magento\Framework\DB\Logger\Quiet"/> with <preference for="Magento\Framework\DB\...
user avatar
27 votes

Advice on Optimizing Site Speed, where to start?

(copied from my own blog at https://www.gui.do/post/101-ways-to-speed-up-your-magento-e-commerce-website) A) Hosting environment/ General tips Get a dedicated server. Host your site in the ...
user avatar
22 votes
Accepted

Magento 2.2 often extremely slow, 100% processor usage after setup:upgrade

TL;DR: Just switch on the config caches. Longer story: I've had the same issue and have been playing around a bit. Steps to reproduce (in developer mode): cache:disable setup:upgrade reload ...
user avatar
  • 336
19 votes
Accepted

List of not-used core modules that can be turn off with no harm

Here's a list of what I think the modules do, it might help knowing what you can try to disable. Important note: please check the module dependencies when disabling modules because some dependencies ...
user avatar
17 votes
Accepted

Ok to truncate report_viewed_product_index

As far as I can see/know this table is included in the event log_log_clean_after. If you look under the file app/code/core/Mage/Reports/etc/config.xml you will see the following snippet. <events&...
user avatar
17 votes
Accepted

How is magento 2 better than magento 1?

This question may be opinion based but I'm just going to enlight some results from the offical white paper regarding Magento 2 performance and scalability Test Configuration Magento Enterprise ...
user avatar
15 votes

Magento 2: move the javascript to the end of the body

First create new module: Create Module Company/DeferJS registration.php <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE,...
user avatar
  • 3,685
14 votes

Disabling modules - performance improvement?

Despite being late with an answer I would like to answer the question You gain even more performance if you physically remove the files. Simply all of them, except Mage_Core ;-) But to disable tight ...
user avatar
  • 334
14 votes
Accepted

ImportExport problem with new destructor of Varien_Image_Adapter_Gd2 in 1.9.2.0

That looks like they tried to make sure to destroy the image resource, but instead introduced a memory leak. I cannot think of a valid reason for this code, to be honest, but I can explain what has ...
user avatar
14 votes
Accepted

OpCache - Recommended Configuration for Magento2

opcache.max_accelerated_files=16000 is definitely low for Magento 2. find . -type f -print | xargs grep "<?php" | wc -l gives me 30736 for my Magento 2 installation (with a code generated in the ...
user avatar
14 votes
Accepted

Magento 2: log slow queries

app/etc/di.xml has the following preference set <preference for="Magento\Framework\DB\LoggerInterface" type="Magento\Framework\DB\Logger\Quiet"/> Add your own module to change the preference ...
user avatar
13 votes
Accepted

How to optimize the query: the product qty bought with each of the products

PHP improvements One big improvement you could in your PHP code would be to avoid using fetchAll to fetch large result sets as it will cause a heavy demand on system and possibly networks resources. ...
user avatar
12 votes

What Default Modules I can disable?

I can add to that: Mage_GiftMessage - seams it's not disableable in 1.8 Mage_XmlConnect - if you don't have / need a mobile app. Mage_Authorizenet Mage_Paypal (if not used as a payment method) ...
user avatar
  • 195k
12 votes

Ok to truncate report_viewed_product_index

I put some research in this some time ago as we also had issues with that table. report_viewed_product_index is used for the recently viewed products. If you don't use this feature: Go and truncate :-)...
user avatar
  • 17.2k
12 votes
Accepted

Magento 2 : What is profiler, what is it's purpose and how can it be used?

We can use a built-in profiler with Magento to perform tasks such as analyzing performance. It can tell us in intricate detail which blocks of code are used in the loading of a slow page, and how ...
user avatar
  • 1,662
10 votes

Disabling modules - performance improvement?

See Marius' answer regarding a simple and quick XML way of disabling modules. Create a single file zzz_Disabled_Modules.xml with the contents <?xml version="1.0"?> <config> <...
user avatar
  • 399
10 votes

Get custom attribute value without loading the product

To retrieve a single attribute directly from the database, you can use $flr01 = $product->getResource()->getAttributeRawValue( $product->getId(), 'flr01', Mage::app()->getStore(...
user avatar
10 votes
Accepted

Create VCL for Magento 2

Log in to the Magento Admin as an administrator. Click STORES > Configuration > ADVANCED > System > Full Page Cache From the Caching Application list, click Varnish Caching Enter a value in the ...
user avatar
10 votes
Accepted

Magento 2 running so slow on localhost development

I tried everything and the only thing it works is the virtual machine that provides bitnami. https://bitnami.com/stack/magento/virtual-machine Seriously, I don't know what has this vm, but goes ...
user avatar
  • 1,433
8 votes
Accepted

How to identify extensions that "phone home"?

We do it with a command line (Bash) function on any respective web server in the stack, monitor_outbound () { tcpflow -p -c -i bond0 '( port 80 or port 443 ) and ' $(ip addr list | grep -Eoh "([0-9]...
user avatar
  • 17.5k
8 votes
Accepted

SQL (sub)query performance

Problem It is a pity, but there is no simple solution for your query. There are multiple basic issues exists in your original queries, that require changing your approach in general: As more joins ...
user avatar
8 votes

List of not-used core modules that can be turn off with no harm

Theoretically you should be able to disable any module if you also disable the module's dependencies. You should be able to see all dependencies by running the cli command bin/magento info:...
user avatar
  • 195k
7 votes

Is it possible to iterate over Magento collections with pagination natively?

I agree with Ben Lessani that you should use the core/iterator resource model to load big collections one row at a time if possible. However, there are limitations. As explained in "...
user avatar
7 votes

Index Tuning Tool of Magento Database

It's a good thing you're thinking about setting indexes on your database tables. This is a quite important, but often forgotten development task. Setting correct indexes depends heavily on the ...
user avatar
  • 17.2k
7 votes
Accepted

Magento Extremely Slow When Cache "Full"

I investigated even more and I think I finally solved the issue. So what can you do to analyse such an issue? In order to have a good idea when the cache becomes too large and if the problem is ...
user avatar
  • 5,544
7 votes

Is cleaning logs from the database a good practice?

Yes, you can configure your settings in Admin to automatically clean up logs. System > Configuration > Advanced > System > Log Cleaning You need to setup the Cron job for this on server....
user avatar
7 votes
Accepted

Difference in performance between load and using collections

Well, the real question here is "what's the difference between load and using collections ?" Using collections is a huge performance boost for the following reasons, especially for EAV entities: ...
user avatar
7 votes
Accepted

Most efficient way to get data in templates

Before I give my answer I believe you may have a problem in your code - sessions should always be called as a singleton. Thus, the line Mage::getModel('checkout/session') should be Mage::getSingleton('...
user avatar
  • 35.6k

Only top scored, non community-wiki answers of a minimum length are eligible