Kill long running SQL

I'm using HDP with Oracle and MYSQL backend databases, with HDP JDBC connector and an SQL IDE.

 

When coding some SQL, sometime, I would like to kill the Query. When I stop it from the IDE, the IDE seems to close connection/statement, but the query seems to continue running on the server, I see it in the database.

 

Is it an expected behaviour ? what is the best solution from the JDBC driver to "kill" the current running statement ?


  • Steven Veum (Progress Software)

    The most direct way to "kill" the running statement is to issue the cancel() on the JDBC statement. This is probably not something you have control over though if you are using a SQL IDE.

     

    There is BETA feature available in HDP 4.6 (and later) that we refer to as lazy fetch. The premise of the feature is to only have the server keep ahead of the application on fetching rows. This generally is just relevant for queries with large result sets. If your application abandons a query, then the server is not busy fetching rows that will never be used. These abandoned queries are automatically cleaned up by the server. This feature is enabled using admin limits API. The feature is tied to limit number 20. To enable the feature, you would set the limit number 20 to something like 10. The value (10 in this example), is the maximum number of active long running queries that are allowed. Once the limit is exceeded, the least recently used query on the server is killed.

     

    The following documentation explains how to set the limit:

    https://documentation.progress.com/output/DataDirect/hybridpipeline/index.html#page/hybrid%2Flimits-api.html%23wwID0EXAC3

     

    Limit 20 is not described in this documentation yet. Limit number 6 is very similar though, but that one just applies to OData. Limit number 20 applies to the JDBC connections.

     

    I hope this helps.