amazon-web-servicesjdbcamazon-redshiftsql-workbench-j

Does long-running queries cancel on redshift side?


When the user executes a long-running query using SQL workbench on Redshift (uses Redshift jdbc driver) when the user cancels it, does it still keep running on Redshift? Is there any possibility that the user must manually go to Redshift and issue a cancel <pid> command to cancel the query?


Solution

  • It can be possible that some queries keep running on Redshift. You can check

    Using Redshift Console

    1. Go to your Redshift Cluster
    2. Click on Query monitoring tab
    3. There is a Query history section in the Query Monitoring Tab
    4. Then select Queries and loads in this section you can view the running query and also have an option to terminate it.

    Using Redshift SQL CANCEL

    1. First you need to find the running query Process ID (PID)
    select pid, starttime, duration,
    trim(user_name) as user,
    trim (query) as querytxt
    from stv_recents
    where status = 'Running';
    
    
    1. Then run cancel #PID command. Please replace #PID with pid from above returned query