V$SESSION is a dynamic performance view in PolarDB for PostgreSQL (Compatible with Oracle) that displays session information for each current session in the database.
A session represents the connection between a user and the database. Each time a user logs on, the database creates a new session. Each row in V$SESSION represents a session that is active or recyclable.
Database administrators (DBAs) use V$SESSION to monitor connected users, diagnose session-level problems, analyze row lock contention, and identify sessions that consume the most resources.
Columns
The following table describes the columns in V$SESSION.
| Column | Type | Description |
|---|---|---|
| SID | numeric | Session identifier. |
| SERIAL# | oid | Serial number of the session. Similar to SID, it uniquely identifies the session. |
| USERNAME | character varying(128) | Name of the user in the session. |
| USER# | oid | Internal identifier of the user. |
| STATUS | character varying(8) | Current status of the session. See Status values. |
| SERVER | character varying(9) | Server connection type. See Server values. |
| MACHINE | text | Name of the client machine. |
| PROGRAM | character varying(30) | Name of the program that started the session. |
| TYPE | text | Session type. See Type values. |
| SQL_ID | character varying(13) | ID of the SQL statement currently being executed. |
| LAST_CALL_ET | numeric | Elapsed time in seconds since the last calling. |
| LOGON_TIME | timestamp with time zone | Time when the session logged on. |
| BLOCKING_SESSION_STATUS | text | Whether this session is being blocked by another session. |
| EVENT | text | If the session is currently waiting, the resource or event it is waiting on. If not in a wait, the resource or event most recently waited on. |
Status values
The STATUS column reports one of the following values:
ACTIVE— The session is currently executing SQL.INACTIVE— The session has no active SQL and is idle.KILLED— The session has been marked for termination.
Server values
The SERVER column reports one of the following values:
DEDICATED— The session is connected through a dedicated server process.SHARED— The session is connected through a shared server process.
Type values
The TYPE column reports one of the following values:
USER— A user session initiated by a client connection.BACKGROUND— An internal background process session.