sp_BlitzCache doesn't work in Azure SQL Database
HOLD ON, before you close this - it's really, really close. Azure SQL Database just doesn't support global temp tables - if you just do a search/replace for ## to #, it works flawlessly. Not saying you need to change this anytime soon, but if we have a separate Azure version where we just find/replace ## to # every time, that's better than screwing around with building one version to work in both places.
Logging this because I'm doing an ASD CC next week, so I'm going through the scripts and figuring out what I need to change. sp_BlitzCache is probably the easiest one I've found so far, hahaha.
This requires detecting the Azure @@VERSION or however we can identify it as Azure. Once we do that, we can make temp table creation dynamic and then error out if you try to @reanalyze while using Azure. The global temp table are only there for supporting reanalyze. Otherwise, I'd get rid of them because they're a headache.
It's really just a balance between those two features - with global temp tables, reanalyze works; without global temp tables, sp_BlitzCache can run anywhere.
If it were up to me, I'd vote for "runs anywhere". But it's a product that we use in the CC, we should probably put in platform detection.
Next week, can you collect @@VERSION and anything else you can think of that would help identify a SQL Azure instance and dump it in the comments? I'll use that to produce an azure compatible version of this.
Also - I feel you on not having version detection built in, but putting that in place means there's only one place for errors to occur. I'd rather have the code be slightly more difficult than have to maintain two copies of the code.
Yeah, this works: CAST(SERVERPROPERTY('edition') AS VARCHAR(100)) = 'SQL Azure'
Baller, will work on that in a few.
On Sat, Jul 18, 2015 at 11:57 AM BrentOzar [email protected] wrote:
Yeah, this works: CAST(SERVERPROPERTY('edition') AS VARCHAR(100)) = 'SQL Azure'
— Reply to this email directly or view it on GitHub https://github.com/BrentOzarULTD/PublicTools/issues/155#issuecomment-122580388 .
Jeremiah Peschka
I take that back - this isn't quick: the ## is all over the place.
It's doable, it's just going to take a different approach and definitely not something I can hack together and get working by Monday.
Totally worth doing, though.
Yeah, I just did the search/replace for ## to #, and it works fine.
On Sat, Jul 18, 2015 at 3:32 PM, Jeremiah Peschka [email protected] wrote:
I take that back - this isn't quick: the ## is all over the place.
It's doable, it's just going to take a different approach and definitely not something I can hack together and get working by Monday.
Totally worth doing, though.
— Reply to this email directly or view it on GitHub https://github.com/BrentOzarULTD/PublicTools/issues/155#issuecomment-122586575 .
Brent Ozar - Microsoft Certified Master, MVP Managing Director, Brent Ozar Unlimited http://www.BrentOzar.com
Closing because: https://www.brentozar.com/archive/2017/07/sp_blitzcache-eventual-compatibility-azure/