Will mysql somehow rerun killed query behind my back? - mysql

I ran a very unique experimental long query about 1 week ago from Sequel Pro against a MySQL 5.5 DB. The query is not used in any codes; just a manual one. I remember I killed it after only a few seconds. Then in the last few days, the DBA keeps finding the exact same query was started again after one being killed. The DBA has verified the query was killed at the time he tried. My workstation has been rebooted at least once and moved out of network connection many times since I first ran that query manually. Sequel Pro had no connection to any DB when one of this rerun occurred. And there seems nothing else in my workstation that would trigger that.
My question: is there some way that the query can get stuck in some server-side job/run list and not being killed properly but get rerun?

Found the cause. A DBA has cron script running in the background looking for slow queries in the slow query log and try to run explain on the query! Apparently the slow queries get rerun again and again.

Related

Does my sql query continue executing after i been disconnected due to long operation?

If I run a SQL query in MySQL workbench and the connections time out after 30 seconds because it is taking a long time. Does my Query continue executing on the MySQL server even though I am disconnected?
For example, if I am doing an update and the update loops over a billion records. Does the MySQL server disconnect me first then it finishes the query after? Or does it disconnect me and terminate the query?
It does. As Mustafa mentioned, you can see the query still running if you look at "Administration tab" --> Management --> Client Connections.
Also good to remember that you can change the 30sec cap to longer, shorter or none.
Yes, MySQL Workbench can disconnect and the query keeps running. This has been reported as a bug, but it's in the "Verified" state, which means it is not fixed: https://bugs.mysql.com/bug.php?id=78809
See also this related SO thread: MySQL Query running even after losing connection
If you have a long-running query that needs to do a bulk update, you may need to change the MySQL Session timeout options in the MySQL Workbench preferences. Alternatively, don't use MySQL Workbench for long-running jobs, use the mysql command line tool.

What is the purpose of the `KILL QUERY` command?

I am beginner to MySQL and SQL and I am learning these technologies from MySQL and MyISAM websites.
I am learning the KILL command now and have learned how to use KILL CONNECTION. But when I come to learn KILL QUERY from MySQL and MyISAM websites where they simply provided information about KILL QUERY that they terminate query that the specified connection id is executing.
Other user (not me) executes INSERT and DELETE queries but when i have used KILL QUERY by getting the connection id of other user via SHOW PROCESSLIST command, it says
Query OK, 0 rows affected (0.01 sec)
But nothing happen to other user.
I just want to know that what is the exact use of this command. What is the purpose of this KILL QUERY command. Can anyone tell me?
Some useful pointers:
How can I stop a running MySQL query?
MySQL Kill query
How to kill all processes for a Specific user
MySQL Manaul - Kill
You need to have some clarity here KILL will kill the connection, but KILL QUERY will only kill that query and will leave that connection intact.
Really, if you are using KILL QUERY on another users command, this can only really be noticable if their query is running for longer than your Kill Query command, so if it's a slow query, because [most] queries will execute and close within a fraction of a second, so by the time you've KILLed the other users query, their query may well have completed and closed anyway.
I suspect this is what you are seeing, that you're trying to kill a query that closes and is finished before the kill command can execute.
Killing queries seems (from literature) only useful for slow and long running queries, and why this is so should be obvious from the above.
Edit:
(I had this ready to post on my original answer and then took it out as being irrelevant, but seems to be more relevant now due to comments!)
From the MySQL Manual:
Note
You cannot use KILL with the Embedded MySQL Server library because the embedded server merely runs inside the threads of the host application. It does not create any connection threads of its own.
So to answer your question in the comment, I think that you may be running MySQL embedded so your kill calls will not function.

Find failed requests and queries that go into deadlock

Some of the requests to my application fail every day. I want to know every time which all queries went into deadlock.
I am running MySQL 5.6 on AWS.
FYI, tool suggestions are also welcome.

MySQL slow down suddenly

On the same database MySQL 5.7.17 (InnoDB) on local PC I run query which takes 25s but after log in on the same db once again I achieved longer execution time - 50s. I suspect that it's MySQL performance issue. It appears many times, sometimes db is performing query longer, next time db speed up and execution takes less time. I'm testing it on many queries in the cmd line client.
One thing which I have changed in cfg is innodb_buffer_pool_size=5G in my.ini
Have anybody has any suspicion what may cause this decrease of performance, or what I have to check?
Thanks for any suggestions!

MySQL Power Outage Affecting MySQL Server - Shuts Down On Its Own

I am new to dealing with mysql settings and admin type issues. About 4-5 hours ago, I had two power outages within 30 minutes of eachother. As a result, my computer shutdown both times, while in the middle of what I can only assume was a around 20-30 commands on mysql at the time. After the first, mysql was unaffected. But after the second, something happened. MySQL Server cannot remain open for more than a few seconds at a time (before the outage, this was not a problem). I am running MySQL Server 5.1.
I can manually start MySQL server using the admin command line (I am running this on Windows): net start mysql. I get a message saying "The MySQL service was started successfully". Then I run a command or (max) two, and then again everything stops working with a 2013 "Lost connection to MYSQL server during query". Then I have to do restart the MySQL Server all over again.
I have some important data in the database which I cannot reach because the connection times out before I can get it out. Is there a way I can fix this connection problem easily? I know my data is in there, because I have gotten a fair amount of it out.
Any help would be appreciated. Please let me know what other information you might need, and how I can get it. I have been trying to find the error log for mysql, and have not found it yet.
And, yes, if I get through this, and even if I dont, I will make sure to create a system to update the data on a regular basis so these types of failures aren't so catastrophic in the future.
Thanks in advance