Excessive queries on inventory_source_carrier_link and inventory_source tables
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 357
- Forks
- 262
- PR merge metrics
- No merged PRs in 30d
Description
### Preconditions (*)
1. Magento 2.4.1 with 3 inventory stock and 300 inventory sources, 70k products
2.Queued stock updates with queue and consumers (async/bulk)
### Steps to reproduce (*)
1.Send multiple stocklevel updates
2.Monitor db queries - notice level of queries:
SELECT `main_table` . * FROM `inventory_source_carrier_link` AS `main_table` WHERE ( ( `source_code` = ? ) )
and
SELECT `main_table` . * FROM `inventory_source` AS `main_table` WHERE ( ( `enabled` = ? ) )

### Expected result (*)
1. Stocklevel updates should happen without any non cached queries
2.
### Actual result (*)
1. [Screenshots, logs or description]

Disabling Modules: Magento_InventoryBundleProduct Magento_InventoryBundleProductAdminUi and Magento_InventoryBundleProductIndexer helped on the situation, decreasing number of queries.
2.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing queued or bulk stock updates with the stated Magento 2.4.1 inventory setup and monitor queries against inventory_source_carrier_link and inventory_source. Compare the query volume with the bundle-product modules enabled and disabled; done means stock updates no longer perform the reported non-cached queries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, database, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100