This is a bit long; but I have been working through queries figuring out where a performance issue is coming from. Appreciate you taking the time to read it.
I have an application running on a Dedicated Server which is in Turn running SQL Server 2012 @ Azure (West Europe if it matters.) My App won't run on the shared service due to functionality gaps in Azuresql. The application that is running has run on all sorts of 2012 servers in the past and I am noticing a weird performance anomaly between Azure and other non azure sql servers.
The issue is around temporary tables - variable tables v #tables again.
We are finding on Azure that variant tables the query durations are considerably longer; very simple example; run 50 times each and averaged out.
Create table #table (contactid uniqueidentifier, AnotherID uniqueidentifier)
insert into #table
select top 100 contactid, AnotherID
from dbo.pdContacts
v
declare @table table (contactid uniqueidentifier, AnotherID uniqueidentifier)
insert into @table
select top 100 contactid, AnotherID
from dbo.pdContacts
Profiler says the stats average out at;
Variable Table : #Table
CPU 47 : 16
Reads 379 : 204
Writes 11 : 0
Duration 83 : 42
The same query, databases on a dedicated server and no load returned
Variable Table : #Table
CPU 16 : 16
Reads 873 : 898
Writes 11 : 0
Duration 5 : 15
In my very simple test the Azure Variant test is almost twice the execution duration as the #table; on stand alone equipment the variant is considerably quicker (which for small tables is consistent with how we have seen it perform.) What constrains the performance of the variant tables that is more noticeable on Azure than stand alone machines; I can manage the performance issues in the short term but would rather than have to optimise the application for azure at the expense of everyone else.
Thanks