This is similar to this question IIS 7.5 web application first request after app-pool recycle very slow and this question Slow first page load on asp.net site but it is not the same. At the point I am profiling, the application pool has already restarted. The answers on those questions are about keeping the application pool alive, which is not helpful in this case
After an application pool recycle, the first database call my ASP.NET application makes is extremely slow. Subsequent calls are extremely fast. This is to a local instance of SQL Server.
Here is a profile of after the application pool is recycled. The call takes 9.7 seconds.
And here it is after the application pools have been up a while. The exact same call takes 12ms.
It's not a caching thing because if I ask the second call to pull back data for a different account it's still extremely fast.
It's really annoying while developing because every time I make a change and compile it recycles the app pool and then it takes far too long for the site to come up again.
What is going on here and is there any way to speed up the first call?