So I already went ahead and created relevant indexes on the tables, and the parts of the request that can be parallelised are. However I wonder why this might still be so slow?
I did console time to check the email request is quite slow at 3 seconds. But it still doesnt plain why the request takes 15 secs in total.
Can I log the SQL that is generated somehow? Any advice on how best to investigate further what is the cause? Should I put the email part in a queue?
p.s. many of my other requests are much more performant.