Why internal stock supply checks all products?

I was analyzing code of stock supply process for internal order points.
I’m confused about the fact that when “implicit_locations” variable has value it search for all existing products. This products are used later to get stock quantities.
Could someone clarify this point?

Indeed I see the change comes from issue4913 and explanation is on documentation:

… If the
stock level of a product without order point on the given warehouse is
below zero, a purchase request is also created. The same happens if
the stock level of a storage location with a provisioning location is
below zero.

This is because when setting the value for the provisioning location you are telling the system that it should provission the need of any product, so we should search for all the products in the system.

But I’m wondering if it will be a good idea to split the computation so we compute it in two steps:

  • One for order points
  • Another for provisioning overflowing locations.

Otherwise, we are computing the stock of all products for all locations that have a order point when having just a single provisioning location.

I’m not sure that making two queries will be faster. There is a high chance that the database must any way read all the moves.

Thanks for your answers.
In my case the customer filled the provisioning location by mistake. As a consequence the supply process became dramatically slow because of large number of products on the system (+10k).