A session is the stateful bridge between a physical transport connection and individual transactions. When a transaction ends (COMMIT / ROLLBACK), session-level states such as SET timezone, session-scoped advisory locks, and temporary tables persist until explicitly cleared.
Under transaction pooling (e.g. PgBouncer transaction mode), server connections are released at transaction boundaries, creating state leakage risks if session-level variables are modified. Stateless applications should prefer transaction-scoped settings like SET LOCAL or SET ... FOR TRANSACTION, which automatically revert upon commit or rollback.