0

When I did show processlist;

It shows status Killed and query NULL in one of the line.

Should we kill this NULL query using Kill QUERY_ID?

Will this impact to database?

shA.t
  • 16,580
  • 5
  • 54
  • 111
Rohan Patil
  • 1,865
  • 1
  • 23
  • 36

1 Answers1

1

When you run a show processlist you will get something as

mysql> show processlist \G
*************************** 1. row ***************************
     Id: 102524
   User: someuser
   Host: localhost
     db: db_name
Command: Query
   Time: 0
  State: NULL
   Info: show processlist
*************************** 2. row ***************************
     Id: 102532
   User: someuser
   Host: host ip 
     db: db_name
Command: Query
   Time: 0
  State: Sending data
   Info: select .....,
2 rows in set (0.00 sec)

Here it will list out the queries which are being currently getting executed and if you want to kill one of them you need to use the ID

For example from above if I need to kill the query and its ID is 102532 it could be done as

kill 102532

Now what are the consequences, say you are running a report which is using some query and its either executing or sending the data and if you kill in the mid then the report data will not have proper value considering the query returning some data.

In most cases the select takes time than insert or delete or update unless its a mass delete or update or insert.

As far as impact on database is concern for select it will have no impact, for insert/update/delete yes you may not have data inserted/updated or deleted if the query is still active.

You can get the complete information of the query using

show full processlist
Abhik Chakraborty
  • 44,654
  • 6
  • 52
  • 63
  • Can I restart mysql where there is a killed query in processlist? – Rohan Patil Apr 23 '15 at 13:33
  • If you re-start mysql then all the queries are killed and you do not need to do it manually, I assume some heave query is killing the mysql server so you need to do it, so yes restarting mysql server in that case would kill all the queries in the process. – Abhik Chakraborty Apr 23 '15 at 13:35