Killing queries on a single database

Hi there!

I would like to construct a SQL query which would kill all active queries on a specific database.

SELECT ID, NODE_ID
FROM information_schema.mv_processlist
WHERE DB = ‘test’ AND STATE = ‘executing’;

This query nicely returns all the ids I should be using in the KILL QUERY query, but I can not find a way to feed them into it in one step.
I’d appreciate any kind of help on this.
Thanks!

I don’t know of a way to do that inside the database in one step. I’d recommend writing a script or program that fetches the IDs with that query and then generates KILL commands for each and runs those back against SingleStoreDB.

Hi Hanson,
Thanks for the confirmation.
I went on and have implemented the logic in our code and use separate queries.
Have a great day!

1 Like