question

Maxbuddy-7921 avatar image
0 Votes"
Maxbuddy-7921 asked KalyanChanumolu-MSFT answered

select top query with order by hangs in sql server 2008

Recently, I restored a SQL 2008 DB as we are migrating to azure sql database.

Select top 50, column from Tablename with order by datefiled. If the table has total 48 rows then totally no problem for the same query.
But if i select top 100 then the query hangs for ever. But the same query works in the other server from where i backuped the db.It is also SQL 2008 version. Kindly help how do i solve the problem . I do not want to change the query.

azure-sql-database
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

KalyanChanumolu-MSFT avatar image
0 Votes"
KalyanChanumolu-MSFT answered

@Maxbuddy-7921 Thank you for reaching out.

Here are a few things you may want to try

Please check if you have the same indexes on the table in both databases. Rebuild the indexes on your new database.
Are there any other open transactions holding your session from returning results? You can run the same query with a (NOLOCK) hint and check
Check if both servers identical in terms of disk and CPU specification?



If an answer is helpful, please "Accept answer" or "Up-Vote" for the same which might be beneficial to other community members reading this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.