Terminating a Long Query

Hi there!

Have anyone taken the “Terminating a Long Query” part of the SQL for Data Analysis course?

I’m having a trouble with this part with the 2 last questions especially.
I’m trying to identify the process ID of the sleep query with the following code:
select pid, query from pg_stat_activity where state = 'active'; but it’s doesn’t look it’s working out.

Do you have any ideas?

Also, I tried the 3rd questions which is ask us to force the sleep command using the pg_terminate_background, but I can not make it neither:
select pg_terminate_background(1663);
It said that there is no functions matches the giver and name argument…

I hope you could give me a clue!! :slight_smile:

Thanks a lot!!
Jacques

Hey Jacques,

It’s very strange that the second question is not passing for you - that is the correct query. Is there any chance you are copy/pasting in the answer? If so, can you please refresh the page and try entering the command manually?

The third question has a typo! The function should be pg_terminate_backend. I’ve gone in and fixed that now. Thanks for bringing this to our attention :slight_smile:

Best,
Lorraine