“select count(id) from table” takes up to 30 minutes to calculate in SQL Azure

前端 未结 3 1306
野趣味
野趣味 2021-02-07 04:30

I have a database in SQL Azure which is not taking between 15 and 30 minutes to do a simple:

select count(id) from mytable

The database is abou

3条回答
  •  情深已故
    2021-02-07 05:10

    I realize this is old, but I had the same issue. I had a table with 2.5 million rows that I imported from an on-prem database into Azure SQL and ran at S3 level. Select Count(0) from Table resulted in a 5-7 minute execution time vs milliseconds on-premise.

    In Azure, index and table scans seem to be penalized tremendously in performance, so adding a 'useless' WHERE to the query that forces it to perform an index seek on the clustered index helped.

    In my case, this performed almost identical Select count(0) from Table where id > 0 resulted in performance matching the on premise query.

提交回复
热议问题