A
A
Andrew2018-10-16 15:24:21
SQL
Andrew, 2018-10-16 15:24:21

How to stop a long SQL query?

There is a database in which logs are written, it was required to analyze the logs for a period of time.
For faster and more convenient work, I decided to copy the records for the required period of time into a separate table using a Select...into query.
This request worked for too long, and after 9 hours it was decided to cancel it. But just like that, the request cannot be canceled - after KILL it hangs in the Suspended and KILLED / ROLLBACK status.
I don't need any rollback, I just need to kill the work of this team.
How to do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Shumov, 2018-10-16
@byte916

you don't have to do anything. And don't try to reboot it. At this moment, the database is engaged in the safe release of resources, rollback of transactions and other unknown muck. Not so sneeze and hello inconsistent data at an unknown point + broken tables

A
Artyom Karetnikov, 2018-10-16
@art_karetnikov

sp_who2 - find out the process id, 75 for example. then kill 75. Otherwise, your transaction will be rolled back until you're blue in the face, namely, exactly the same time as the request was.
And I would not take a steam bath in this case for integrity of the data in general in any way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question