2

I have statement_timeout set to 10000 (10 seconds) for a user in my Postgres database. However when I look at active queries in pg_stat_activity I find queries running for over 10 seconds (in some cases longer than 10 minutes). I set statement_timeout on the role executing these queries, and I have verified that in the pg_user table the user has statement_timeout=10000 set.

These statements are all inserts and I've verified there are no ungranted locks.

Why are these queries not being killed after the timeout?

2
  • Did you reload your config? With pg_reload_conf() function or restarting your db? Commented Sep 26, 2018 at 2:18
  • Does "show statement_timeout" showing you the correct value? Commented Sep 26, 2018 at 2:19

1 Answer 1

6

It appears the issue is that the transactions are in the idle state (and since this is Postgres 10 I can further tell you the wait_event is ClientRead) and this means they are governed by a different timeout (although the documentation is ambiguous about this). The relevant config to set is idle_in_transaction_session_timeout.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.