Thread: Statement.cancel() doesn't seem to work

Statement.cancel() doesn't seem to work

From
JN
Date:
Hi, I'm trying to cancel a long-running statement (takes about 400
seconds) by calling PreparedStatement.cancel() from another thread,
but it's not working.  Specifically, the call to
PreparedStatement.cancel() completes normally, but the executing
statement seems to complete normally (i.e., it still takes the same
amount of time to complete, and it does not throw any exception).  The
sql being executed is a delete ("delete from qos_data where
report_time < ?").  Is PreparedStatement.cancel() not implemented?

Thanks,
Jim

Re: Statement.cancel() doesn't seem to work

From
Oliver Jowett
Date:
JN wrote:
> Hi, I'm trying to cancel a long-running statement (takes about 400
> seconds) by calling PreparedStatement.cancel() from another thread,
> but it's not working.  Specifically, the call to
> PreparedStatement.cancel() completes normally, but the executing
> statement seems to complete normally (i.e., it still takes the same
> amount of time to complete, and it does not throw any exception).  The
> sql being executed is a delete ("delete from qos_data where
> report_time < ?").  Is PreparedStatement.cancel() not implemented?

It is implemented, but it just requests that the backend cancels any
query in progress - there are no guarantees that it will be effective.

Does the query get canceled if you manually send a SIGINT to the
relevant backend?

-O