In Oracel V$OPEN_CURSOR
include a sid field, but the pg_cursors
table in Postgres has no connection with other system catalogs. Is it possible to get such information in PostgreSQL? If i clearly understand, there are no session ids in PostgreSQL and usualy using backend pid. I have get a list of tables with opened cursors, but it can not help me, because there is no connection between pg_tables
and pg_stat_activity
.
CodePudding user response:
In PostgreSQL, a cursor only exists in and for the current database connection. So the session that can use a cursor is always only the one that opened it. You can see all open cursors of the current session in the view pg_cursors
. Since this information is not stored in shared memory, there is no way to see the cursors for a different database connection.