0

I have a strange situation in my PostgreSQL server. I have the below idle query that keeps running in all databases in the server.

datid            | 1029662
datname          | ganar
pid              | 19022
usesysid         | 10
usename          | postgres
application_name | 
client_addr      | 
client_hostname  | 
client_port      | -1
backend_start    | 2023-08-27 10:10:23.265554+00
xact_start       | 
query_start      | 2023-08-27 10:18:07.886526+00
state_change     | 2023-08-27 10:18:07.886626+00
wait_event_type  | Client
wait_event       | ClientRead
state            | idle
backend_xid      | 
backend_xmin     | 
query            | SELECT version();
backend_type     | client backend

If I tried to create a database named "test", it will have the same query running even without connecting to it via the "postgres" user.

datid            | 1887973
datname          | test
pid              | 19021
usesysid         | 10
usename          | postgres
application_name | 
client_addr      | 
client_hostname  | 
client_port      | -1
backend_start    | 2023-08-27 10:10:23.210437+00
xact_start       | 
query_start      | 2023-08-27 10:18:07.885979+00
state_change     | 2023-08-27 10:18:07.886143+00
wait_event_type  | Client
wait_event       | ClientRead
state            | idle
backend_xid      | 
backend_xmin     | 
query            | SELECT version();
backend_type     | client backend

I've tried to kill this process but after 5 sec, it's getting created again.

3
  • 1
    The fact is, a client is connecting as the postgres user and doing SELECT version(). Now you need to track down what that client is. Best guess some sort of monitoring program. I would start by looking at the Postgres log. Commented Aug 27, 2023 at 15:22
  • backend_type | client backend, this shows you that some client is doing this. Commented Aug 27, 2023 at 16:03
  • Note that it is not the "idle query" that keeps the connection open. It is the client that forgets to close the connection. Commented Aug 28, 2023 at 6:19

1 Answer 1

0

The issue was from the monitoring system, I've excluded the database from the monitoring system and worked fine. Thank you all.

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

2 Comments

Rather than not monitoring the database, fix the monitoring system so that it does not leak connections.
I don't need to monitor it as it's just a test database. So, I've excluded it from the monitoring system and kept the rest of the databases

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.