pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedCommand line session and running queries
2+ messages / 2 participants
[nested] [flat]
* Command line session and running queries
@ 2018-08-22 09:03 imp3 <impwins@yahoo.it>
0 siblings, 1 reply; 2+ messages in thread
From: imp3 @ 2018-08-22 09:03 UTC (permalink / raw)
To: pgsql-general
Hello,I've run an update query inside command line tool (psql) then I've exit the tool (closing the window).
When I re-logged in, I've noticed in pg_stat_activity that my query was still running.I used the command pg_cancel_backend with the right PID, but it returned "f" few seconds later.I re-checked pg_stat_activity and I was not able to see my query; there was only an autovacuum running on the table impacted by my query.Since my update query usually takes about one hour, I was wandering what happened.
Is postgres regularly checking command line session? If session has expired, would postgres stop the query and rollback it?
I'm using both client and server v10.1.
Thanks in advance.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Command line session and running queries
@ 2018-08-23 08:56 Laurenz Albe <laurenz.albe@cybertec.at>
parent: imp3 <impwins@yahoo.it>
0 siblings, 0 replies; 2+ messages in thread
From: Laurenz Albe @ 2018-08-23 08:56 UTC (permalink / raw)
To: imp3 <impwins@yahoo.it>; pgsql-general
imp3 wrote:
> I've run an update query inside command line tool (psql) then I've exit the tool (closing the window).
>
> When I re-logged in, I've noticed in pg_stat_activity that my query was still running.
> I used the command pg_cancel_backend with the right PID, but it returned "f" few seconds later.
> I re-checked pg_stat_activity and I was not able to see my query; there was only an autovacuum running on the table impacted by my query.
> Since my update query usually takes about one hour, I was wandering what happened.
>
> Is postgres regularly checking command line session? If session has expired, would postgres stop the query and rollback it?
>
> I'm using both client and server v10.1.
The query probably endet by itself between the point in time when you saw
it in pg_stat_activity and when you tried to cancel it.
The PostgreSQL backend will only notice that the client has died when it
is done processing the query and tries to send an answer to the client.
If that is a regular problem for you, you could set "statement_timeout"
to put an upper limit on "runaway" queries.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2018-08-23 08:56 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-08-22 09:03 Command line session and running queries imp3 <impwins@yahoo.it>
2018-08-23 08:56 ` Laurenz Albe <laurenz.albe@cybertec.at>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox