Skip to content

Instantly share code, notes, and snippets.

@muhammad-asn
Last active July 2, 2025 06:02
Show Gist options
  • Save muhammad-asn/f63e31374d10b71b9bb489cb08fdbbdc to your computer and use it in GitHub Desktop.
Save muhammad-asn/f63e31374d10b71b9bb489cb08fdbbdc to your computer and use it in GitHub Desktop.
Check Timeout Related Configuration PostgreSQL (TimescaleDB)
  1. Check TimescaleDB/Postgres Config in Kubernetes

    kubectl exec -it <pod-name> -- psql -U <username> -d <database>
  2. Run this

    SHOW statement_timeout;
    SHOW idle_in_transaction_session_timeout;
    SHOW tcp_keepalives_idle;
    SHOW tcp_keepalives_interval;
    SHOW tcp_keepalives_count;
    
    SELECT name, setting, unit, short_desc FROM pg_settings WHERE name ILIKE '%timeout%';
                name                 | setting | unit |                                   short_desc
    -------------------------------------+---------+------+--------------------------------------------------------------------------------
     archive_timeout                     | 60      | s    | Sets the amount of time to wait before forcing a switch to the next WAL file.
     authentication_timeout              | 60      | s    | Sets the maximum allowed time to complete client authentication.
     checkpoint_timeout                  | 300     | s    | Sets the maximum time between automatic WAL checkpoints.
     deadlock_timeout                    | 1000    | ms   | Sets the time to wait on a lock before checking for deadlock.
     idle_in_transaction_session_timeout | 0       | ms   | Sets the maximum allowed idle time between queries, when in a transaction.
     idle_session_timeout                | 0       | ms   | Sets the maximum allowed idle time between queries, when not in a transaction.
     lock_timeout                        | 0       | ms   | Sets the maximum allowed duration of any wait for a lock.
     statement_timeout                   | 0       | ms   | Sets the maximum allowed duration of any statement.
     tcp_user_timeout                    | 0       | ms   | TCP user timeout.
     wal_receiver_timeout                | 60000   | ms   | Sets the maximum wait time to receive data from the sending server.
     wal_sender_timeout                  | 60000   | ms   | Sets the maximum time to wait for WAL replication.
  3. Check by configmap

    kubectl get configmap <configmap-name> -o yaml
  4. Check activity

    psql ==> select now() - query_start AS running_time,pid,usename,query,state from pg_stat_activity
     running_time | pid | usename | query | state
    --------------+-----+---------+-------+-------
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment