Perhaps a stupid question but since I don't know how the databaseengine really works under the hood I don't know the answer.
More specifik I've learnt that the sql always tweaks the query so that it is the most optimized for the server. Not only just optimizing speed but also resource management.
So could could it be that my tuning of the query has a greater impact on server resources than the original long running query and can I see that somehow?
If so what are the usual ways to bring down the server trying to tune a query?
Eg. if I have a query that runs for 10m and I optimize to 30s could those 30s have a greater impact on the server performance than the 10min query?