magento / magento/inventory

Excessive queries on inventory_source_carrier_link and inventory_source tables

Open
#3,234 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Progress: ready for grooming
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` = ? ) )

![image](https://user-images.githubusercontent.com/1308059/98039322-d1a47400-1e1e-11eb-9392-abb972cbcdea.png)

### Expected result (*)

1. Stocklevel updates should happen without any non cached queries
2.

### Actual result (*)

1. [Screenshots, logs or description]
![image](https://user-images.githubusercontent.com/1308059/98039390-eb45bb80-1e1e-11eb-850e-a8a49afcc8b3.png)

Disabling Modules: Magento_InventoryBundleProduct Magento_InventoryBundleProductAdminUi and Magento_InventoryBundleProductIndexer helped on the situation, decreasing number of queries.

2.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.