Azure SQL Table taking too long to load for more than 100 thousand records

Rama Gilaka 41 Reputation points
2022-08-26T21:01:51.627+00:00

I am running a simple select query for azure sql table , taking 5 minutes to load,, tried auto tuning, has primary key and clustered Index, please suggest how to fix this?

Azure SQL Database
{count} votes

Accepted answer
  1. Bjoern Peters 8,921 Reputation points
    2022-08-27T22:08:40.207+00:00

    From what I know and from my understanding, you are really running a simple query on a very large table on a very small Azure SQL DB.

    Until now, you haven't told us what kind and size of Azure SQL database you are running...

    From what I can see in the execution plan, it looks like you are running an Azure SQL DB with only two vCores (according to EstimatedAvailableDegreeOfParallelism) which means that your database has a maximum of 6GB RAM! But according to your ExecPlan, your query would like to have, to run optimally, at least 35GB RAM (optimally => without spilling data to the drive)...

    So your query reads data from your database, stores it on disk, load another part of the data, and saves it on a disk.... over and over again... if the process finishes, it will be displayed to you from the disk...

    Your ExecPlan shows an AvgRowSize="55171" (Bytes) and an EstimateRows="683321" => 683321*55171= 37699502891 Bytes = ~38GB

    That's why your query runs that slow ;-)


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.