Magento 2 Please update innodb_buffer_pool_size or decrease batch size value
-
14-04-2021 - |
Question
After installing Magento 2.2.2 when I check my error log I get this warning.
Memory size allocated for the temporary table is more than 20% of innodb_buffer_pool_size. Please update innodb_buffer_pool_size or decrease batch size value (which decreases memory usages for the temporary table). Current batch size: 100000; Allocated memory size: 50000000 bytes; InnoDB buffer pool size: 134217728 bytes.
Where the error is saying memory size allocated for the temporary table is more than 20%. Which temporary table is it referencing to? How should I resolve it?
Solution
Magento can increase the memory for processing a large amount of data by using memory engines instead of InnoDB. The algorithm increases the memory value for the max_heap_table_size and tmp_table_size MySQL parameters.
When the allocated memory size for a temporary table will be greater than 20% of innodb_buffer_pool_size, the error message is written to the Magento log.
To prevent this error message, you need to update default Batching configuration of catalog_category_product (Category Products) indexer because "Current batch size: 100000".
For more details, take a look here.
OTHER TIPS
- Go to your server
MySQL settings file (my.ini)
- Search for
innodb_buffer_pool_size
and increase this value.
The file is at /etc/my.cnf in root SSH, since the full path wasn't noted previously. Upon making any changes to /etc/my.cnf file, please restart MySQL for those changes to take effect
Try to update the value for batchRowsCount
to 10000
in {Your_Module_Name}/etc/di.xml
file of catalog_category_product
(Category Products) indexer Magento\Catalog\Model\Indexer\Category\Product\Action\Full
<type name="Magento\Catalog\Model\Indexer\Category\Product\Action\Full">
<arguments>
<argument name="batchRowsCount" xsi:type="number">10000</argument>
<argument name="batchSizeManagement" xsi:type="object">Magento\Catalog\Model\Indexer\CategoryProductBatchSize</argument>
</arguments>
</type>