Doubt how to make a thread with select and cancel query executed in the database

Asked

Viewed 74 times

0

I am running a query within a thread and set a time limit for it to run or else stop would be the user himself can cancel the select. The problem is that I stop the thread but the query keeps running in the database.

I had the idea to stop the query with a command from postgresql I only need the pid query, and then I select the following:

(
    SELECT
        p.pid
    FROM
        pg_stat_activity p
    WHERE
        state = 'active'
        AND query LIKE '%SELECT * FROM GCEPDC02, pg_sleep(%'
        AND query NOT LIKE '%FROM pg_stat_activity%')

but this select does not return me anything, any suggestion?

  • Good morning Andre.. Everything right? Dude didn’t even know you could run a query for a while.. How did you set this?? or how do you do it????

  • Oops, I’ve set a timer in Design q qndo der tempo close the thread and do a select pg_static (something like that) to get the pid to cancel the thread

  • ha ta... :) I thought there was some HIDDEN property that could set :)

  • Unfortunately n friend

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.