Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][ADD][MIG] stock_inventory: forward port feature, add index #2231

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from

Conversation

thomaspaulb
Copy link

@thomaspaulb thomaspaulb commented Jan 10, 2025

On a system with many move lines, opening an inventory adjustment view can result in the following slow query:

SELECT
    min(l.id) AS id,
    count(l.id),
    l.inventory_adjustment_id
FROM stock_move_line l
LEFT JOIN stock_inventory i ON l.inventory_adjustment_id = i.id
WHERE l.inventory_adjustment_id = 17
AND ((l.company_id = 1) OR l.company_id IS NULL)
GROUP BY l.inventory_adjustment_id,i.date,i.id;
ORDER BY  "stock_move_line__inventory_adjustment_id"."date" DESC,"stock_move_line__inventory_adjustment_id"."id" DESC;

The system will have to churn through all the millions of move lines to find the matching ones. This index makes that search quicker.

AaronHForgeFlow and others added 2 commits January 10, 2025 13:19
…ent_id

In systems with many move lines, finding the move lines associated with a certain
inventory adjustment can become very slow. This index assists.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants