Submit Stock Transaction is very slow after upgraded to V12

I believe the answer to your “why” question is Perpetual Inventory. More specifically, how the concept of Perpetual Inventory is being modeled in ERPNext.

Here’s a long but interesting thread.
TLDR: Some of us don’t understand why it necessitates summing the entire inventory balance, every time you post a new entry.