How to: Include identifier with a query

View: New views
2 Messages — Rating Filter:   Alert me  

How to: Include identifier with a query

by listread :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Greetings!

We are searching for names that might or might not exist in a 4 million
row db and have to do a lot of fuzzy searches that often don't return
results.

I would like the use to have the option of killing a query process.  
Since we are apt to have several queries running KILL QUERY doesn't seem
to work.  I would like to use KILL (process id) instead.  We can use
SHOW FULL PROCESSLIST to get a complete list of the processes, but we
need for the code to identify which one to kill.

Here's the question:  How can I "flag" a particular query so it can be
identified from the array SHOW FULL PROCESSLIST generates?

Thanks!

- Ron

Re: How to: Include identifier with a query

by chris smith-9 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

listread wrote:

> Greetings!
>
> We are searching for names that might or might not exist in a 4 million
> row db and have to do a lot of fuzzy searches that often don't return
> results.
>
> I would like the use to have the option of killing a query process.  
> Since we are apt to have several queries running KILL QUERY doesn't seem
> to work.  I would like to use KILL (process id) instead.  We can use
> SHOW FULL PROCESSLIST to get a complete list of the processes, but we
> need for the code to identify which one to kill.

KILL <id> works on the process id.

mysql> show processlist;
+----+------+-----------+------+---------+------+-------+------------------+
| Id | User | Host      | db   | Command | Time | State | Info             |
+----+------+-----------+------+---------+------+-------+------------------+
| 40 | root | localhost | NULL | Query   |    0 | NULL  | show
processlist |
+----+------+-----------+------+---------+------+-------+------------------+
1 row in set (0.00 sec)


The first column *is* the process id.

> Here's the question:  How can I "flag" a particular query so it can be
> identified from the array SHOW FULL PROCESSLIST generates?

You can put comments in your sql:

mysql> /** generated by x */ select now();
+---------------------+
| now()               |
+---------------------+
| 2009-11-03 08:45:49 |
+---------------------+
1 row in set (0.00 sec)

--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php