How to: Include identifier with a query

How to: Include identifier with a query

am 02.11.2009 14:16:23 von listread

--------------070500050800080305040904
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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

--------------070500050800080305040904--

Re: How to: Include identifier with a query

am 02.11.2009 14:22:44 von Trevor Gryffyn

I looked into this years ago for something I was doing, but don't remember
looking for a solution in MySQL.

Just wanted to share that.. um.. I think it was with MS SQL Server.. there
was a way to put a tag in your DSN connection string that would show up
on the process list. I don't know if that helps, but just to add to the
list of "how *some* people do it".

Good luck!

-TG

----- Original Message -----
From: listread
To: php-db@lists.php.net
Date: Mon, 02 Nov 2009 07:16:23 -0600
Subject: [PHP-DB] How to: Include identifier with a query

> 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
>
>

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

Re: How to: Include identifier with a query

am 02.11.2009 22:46:10 von dmagick

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 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