# idle_session_timeout

> Terminate sessions that sit idle waiting for a client query longer than this; 0 disables.

Source: https://sqlly.app/sql-configuration/postgresql/idle-session-timeout
Last updated: 2026-11-30
License: Text and data [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) (credit SQLly, sqlly.app); code and SQL snippets [MIT](https://opensource.org/license/mit). [Details](https://sqlly.app/license).

**Default**

`0 (disabled)`

**Range**

0 to about 24 days, in ms

**Restart needed**

No

**Default checked on**

PostgreSQL 18

## What it does

Unlike idle_in_transaction_session_timeout it leaves sessions parked inside an open transaction alone, and an idle session without a transaction costs the server little. Added in PostgreSQL 14.

## Default value

`0 (disabled)`. 0 (PostgreSQL 18); the parameter exists from PostgreSQL 14.

## Check the current value

```
SHOW idle_session_timeout;

SELECT setting, unit, boot_val, context, source, pending_restart
FROM pg_settings
WHERE name = 'idle_session_timeout';
```

## Change it

```
ALTER SYSTEM SET idle_session_timeout = '10min';
SELECT pg_reload_conf();
```

No restart: reload with SELECT pg_reload_conf() or pg_ctl reload. It cannot be changed per session (context is sighup).

## When to change it

Against half-dead clients and forgotten sessions, especially where no connection pool sits in front of the application; scope it per role with ALTER ROLE rather than server-wide.

## What can go wrong

It kills sessions the client still considers parked, so dashboards, schedulers or IDEs that hold a connection between jobs see it vanish with 'terminating connection due to idle-session timeout'. Sessions idle inside a transaction are exempt.

## The closest setting on other engines

| Engine | Setting | Default | Restart |
| --- | --- | --- | --- |
| PostgreSQL | `idle_session_timeout` this page | `0 (disabled)` | No |
| MySQL | [`net_write_timeout`](https://sqlly.app/sql-configuration/mysql/net-write-timeout) | `60` | No |
| SQL Server | [`remote query timeout (s)`](https://sqlly.app/sql-configuration/sql-server/remote-query-timeout) | `600` | No |
| Oracle | [`max_idle_time`](https://sqlly.app/sql-configuration/oracle/max-idle-time) | `0 (no limit)` | No |

## Questions about idle_session_timeout

### What is the default value of idle_session_timeout in PostgreSQL?

0 (disabled). 0 (PostgreSQL 18); the parameter exists from PostgreSQL 14.

### Does changing idle_session_timeout require a restart?

No. No restart: reload with SELECT pg_reload_conf() or pg_ctl reload. It cannot be changed per session (context is sighup).

### When should I change idle_session_timeout?

Against half-dead clients and forgotten sessions, especially where no connection pool sits in front of the application; scope it per role with ALTER ROLE rather than server-wide.

Back to all [PostgreSQL settings](https://sqlly.app/sql-configuration/postgresql), or check the [PostgreSQL manual](https://www.postgresql.org/docs/current/runtime-config.html) for every option.

## Related PostgreSQL settings

- [`idle_in_transaction_session_timeout` Terminate sessions that sit idle inside an open transaction for longer than this; 0 disables.](https://sqlly.app/sql-configuration/postgresql/idle-in-transaction-session-timeout)
- [`statement_timeout` Abort any statement that runs longer than this; 0 disables.](https://sqlly.app/sql-configuration/postgresql/statement-timeout)
- [`tcp_keepalives_idle` Seconds of connection inactivity before the server probes the client with TCP keepalives.](https://sqlly.app/sql-configuration/postgresql/tcp-keepalives-idle)

## Related on SQLly

- [Diagnosing a slow SQL query Performance guide](https://sqlly.app/sql-performance/slow-query)
