Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit bd9b0a9

Browse files
authored
Merge pull request #8518 from vzabaznov/patch-9
Update indexer-batch.md
2 parents f56e383 + 890d479 commit bd9b0a9

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

src/guides/v2.4/extension-dev-guide/indexer-batch.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,48 @@ The following examples illustrate how to define a custom batch size for configur
104104
</type>
105105
```
106106

107+
### Setting batch size with environment variables
108+
109+
As of Magento 2.4.3, it is possible to configure the batch size with environment variables, or in `app/etc/env.php`, for the following indexers:
110+
111+
* `cataloginventory_stock`
112+
* `catalog_category_product`
113+
* `catalogsearch_fulltext`
114+
* `catalog_product_price`
115+
* `catalogpermissions_category`
116+
* `inventory`
117+
118+
Here is an example of the configuration in `app/etc/env.php`
119+
120+
```php
121+
<?php
122+
return [
123+
'indexer' => [
124+
'batch_size' => [
125+
'cataloginventory_stock' => [
126+
'simple' => 200
127+
],
128+
'catalog_category_product' => 666,
129+
'catalogsearch_fulltext' => 333,
130+
'catalog_product_price' => [
131+
'simple' => 200,
132+
'default' => 500,
133+
'configurable' => 666
134+
],
135+
'catalogpermissions_category' => 999,
136+
'inventory' => [
137+
'simple' => 210,
138+
'default' => 510,
139+
'configurable' => 616
140+
]
141+
]
142+
]
143+
];
144+
```
145+
146+
The batches size for `catalog_category_product`, `catalogpermissions_category`, `catalogpermissions_category` will be set for all product types.
147+
Batch size for `cataloginventory_stock`, `catalog_product_price`, `inventory` can be set up for each product type. If no batch size is set for a specific product type, the `default` value is used. We recommend setting the `default` value for each indexer to allow for different batch sizes per product type.
148+
107149
## Indexer Table Switching
108150

109151
Magento optimizes certain indexer processes to prevent deadlocks and wait locks caused by read/write collisions on the same table. In these cases, Magento uses separate tables for performing read operations and reindexing. As a result of this table switching process, customers are not impacted when you run a full reindex. For example, when `catalog_product_price` is reindexing, customers won't be slowed down as they navigate on Categories pages, search products, or user layer navigation filters with price filters.

0 commit comments

Comments
 (0)