Where is the SQL Plan Cache located?

Is the SQL Plan Cache located in a certain Database? i.e. Master, msdb? Or just resides in Memory but not a specific Database per se?

We have this weird performance problem. It's possible SQL Server had a bad query plan. But I flushed the cache. So if I wanted to restore the bad query plan to do more analysis.

It's my understanding that it's in memory only (at least prior to the Query Store; obviously the query store physically stores it somewhere).

If you know which query has the bad plan, naturally capture that plan prior to clearing the cache.


Yeah, I should have captured it first.

But if I had, I'm not sure that I can force a plan. But at least we could have looked at it.