Author |
Topic |
denis_the_thief
Aged Yak Warrior
596 Posts |
Posted - 2011-10-06 : 11:16:09
|
Why can it take so long to cancel a query? I ran a select statement through Management Studio and it hangs saying 'Cancelling Query'. If it was rolling back I could see it but for a select statment? |
|
theboyholty
Posting Yak Master
226 Posts |
Posted - 2011-10-06 : 11:52:40
|
Can I suggest you post your code?---------------------------------------------------------------------------------http://www.mannyroadend.co.uk A Bury FC supporters website and forum |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-06 : 12:10:35
|
it may be an intensive transaction you executed and it needs to rollback all applied changes------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
denis_the_thief
Aged Yak Warrior
596 Posts |
Posted - 2011-10-06 : 13:20:01
|
quote: Originally posted by visakh16 it may be an intensive transaction you executed and it needs to rollback all applied changes------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
This one was a select only. It was slow to begin with. But I was just surprised cancellinging would take so long... |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-06 : 13:22:42
|
select itself will take long time to get cancelled if amount of data its retrieving is very large.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
denis_the_thief
Aged Yak Warrior
596 Posts |
Posted - 2011-10-06 : 13:36:50
|
quote: Originally posted by visakh16 select itself will take long time to get cancelled if amount of data its retrieving is very large.
Yes, in this case lots of data, over a network. That's what I don't get, why can't it just stop what it's doing. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-06 : 13:38:04
|
it will stop once it has done with rollback of what it was doing------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
denis_the_thief
Aged Yak Warrior
596 Posts |
Posted - 2011-10-06 : 13:52:33
|
quote: Originally posted by visakh16 it will stop once it has done with rollback of what it was doing------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
But what would it need to roll back if it is a Select only?I guess read locks but this one had very few records and only one table. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-06 : 13:59:07
|
you never knew. if you're using some functions like ROW_NUMBER() etc it will internally do sorting for which it uses internal temporary tables etc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|