Azure Analytics Synapse SQL very slow?

silver subie 0 Reputation points
2023-04-26T19:35:18.5366667+00:00

Hi,

We recently moved to the lake. I was told we share resource within the region so it depends on usage, SQL queries' response time could vary.

Is it normal for this sample query below takes 7 minutes and 20 seconds? That's super slow.

SELECT 
  t1.Period,convert(date, left(t1.Period,4)+'-'+Right(t1.Period,2)+' -01') as transdate,
  SUM(t2.Savings) AS Balance, 'Savings Account' as Type
FROM 
  a t1
JOIN 
  a t2 ON LEFT(t2.Period, 6) < LEFT(t1.Period, 6)
GROUP BY 
  t1.Period
union all
SELECT 
  Period, convert(date, left(t1.Period,4)+'-'+Right(t1.Period,2)+' -01') as transdate,
  (
    SELECT SUM(openingBalance)
    FROM b 
    WHERE Period < t1.Period
  )  AS Balance, 'Beginning Daily Cash Balance' as Type 
FROM 
  b t1
  group by period 
ORDER BY 
  Period desc
Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,193 questions
Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
3,814 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ShaikMaheer-MSFT 35,786 Reputation points Microsoft Employee
    2023-04-29T14:33:31.2566667+00:00

    Hi silver subie,

    Thank you for posting query in Microsoft Q&A platform.

    Performance of query depends on lot of parameters. I would encourage you to consider checking below two links and see which can fit in your case to increase performance.

    https://learn.microsoft.com/en-us/azure/synapse-analytics/sql/best-practices-serverless-sql-pool

    https://techcommunity.microsoft.com/t5/fasttrack-for-azure/synapse-serverless-sql-pool-performance-and-cost-optimization/ba-p/3673286

    Hope this helps. Please let me know how it goes and if any further queries.


    Please consider hitting Accept Answer button. Accepted answers help community as well.