select insert query optimization on large volume MYSQL 8.x
The first thing about your query is the indexing on bidPrice needs to map to your join criteria:
Hence the index on bidPrice should be:
idRequest, idExchangePair, idExchangePlatform

The first two can be in either order as both are referenced with an = and idExchangePlatform is a range &lt; based search so leave this last.
Extend one of the existing indexes that begins with the same element(s).
The subquery SELECT statements in the query are ugly.
SELECT ...,
   GREATEST(bp1.lastPrice, bp2.lastPrice),
   (ABS(bp1.lastPrice - bp2.lastPrice))*100)/GREATEST(bp1.lastPrice, bp2.lastPrice)

will make it simpler (but probably won't help with speed significantly) - ref: GREATEST.
To help with such a large scan, batch this up based on the first element of the index above.
So:
INSERT ... SELECT ... JOIN ... WHERE idRequest &lt; 10000;
INSERT ... SELECT ... JOIN ... WHERE idRequest BETWEEN 10001 AND 20000;
....