stopping or aborting a long query

2003-12-04 Thread Robert Citek
Hello all,

How does one stop or abort a query?

I was doing some experimenting with MySQL and created a table with 
100,000 records.  I then did a join like so:
  create table foo select foo.name, foo.val from foo, foo x, foo y, foo 
z ;

This took a long time.  So, I aborted with Ctrl-C (^C) which bumped me 
out of the mysql client.  I then reconnected, issued 'show 
processlist;', and issued a 'kill ###;' for the process.  Is this the 
way to abort a query?  Or is there a more graceful method that aborts 
the query but keeps me in the mysql client?

Have googled and searched the mailing list archives and faq, but 
nothing so far.  Hints for search terms and pointers to a URL are 
greatly appreciated.

Regards,
- Robert
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


RE: stopping or aborting a long query

2003-12-04 Thread Mike Johnson
From: Robert Citek [mailto:[EMAIL PROTECTED]

 How does one stop or abort a query?
 
 I was doing some experimenting with MySQL and created a table with 
 100,000 records.  I then did a join like so:
create table foo select foo.name, foo.val from foo, foo x, 
 foo y, foo 
 z ;
 
 This took a long time.  So, I aborted with Ctrl-C (^C) which 
 bumped me 
 out of the mysql client.  I then reconnected, issued 'show 
 processlist;', and issued a 'kill ###;' for the process.  Is this the 
 way to abort a query?  Or is there a more graceful method that aborts 
 the query but keeps me in the mysql client?
 
 Have googled and searched the mailing list archives and faq, but 
 nothing so far.  Hints for search terms and pointers to a URL are 
 greatly appreciated.


When I need to kill a query, I skip the Ctrl-C step and just open another session on 
the client and kill it from there. The previous window will say something about the 
MySQL server going away, but can generally reconnect on its own if you give it a line 
feed.

However, I've found that when I kill a query, more often than not it just hangs in the 
processlist. In fact, we've had queries that hang and prevent other queries from 
getting to the table for so long that we end up restarting the server to free it up. 
Ugh.

I haven't researched it much, but has anyone else seen this hanging query problem 
before? It was probably 3.23 at that point (we recently upgraded to 4, but haven't 
done much to warrant the situation since). The status for the process usually says 
'killed' if that helps.


-- 
Mike Johnson
Web Developer/Systems Asst.
Smarter Living, Inc.
phone (617) 497-2500 x226

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]