1

I am using Monetdb in a java application via the JDBC driver. I need to cancel long running queries, or queries that are no longer relevant. Since monetdb JDBC driver does not support jdbc statement cancelling, I have implemented my query cancelling mechanism following what described here: https://www.monetdb.org/Documentation/Cookbooks/SQLrecipes/monitor

First, I retrieve the qtag of the query to cancel, and then execute the command call sys.stop(<qtag>).

I have monitored the queue of active queries via the queries

select * from sys.queue()

I see many cancelled queries are in a stopping status, and they stay there for a really long time (much more than it takes for the query to complete), and possibly forever, preventing genuine queries to be executed it seems. Closing the JDBC connection clear these queries in this stopping state: I am aware that when you cancel a query, you cannot interrupt the current MAL operation which is executed, but I don't understand what this stopping state means, and why cancelled queries stay there for such a long time. Am I doing something wrong ? Why closing the jdbc connection remove all these queries in a stopping status ? How can I effectively cancel queries without compromising the monetdb server.

0 Answers0