Updated on 2024-06-03 GMT+08:00

PV_SESSION_MEMORY_DETAIL

PV_SESSION_MEMORY_DETAIL displays the memory usage of sessions based on the MemoryContext node. When enable_thread_pool is set to on, this view contains memory usage of all threads and sessions.

The memory context TempSmallContextGroup collects information about all memory contexts whose value in the totalsize column is less than 8192 bytes in the current thread, and the number of the collected memory contexts is recorded in the usedsize column. Therefore, the totalsize and freesize columns for TempSmallContextGroup in the view display the corresponding information about all the memory contexts whose value in the totalsize column is less than 8192 bytes in the current thread, and the usedsize column displays the number of these memory contexts.

You can run the SELECT * FROM PV_SESSION_MEMCTX_DETAIL(threadid, ''); statement to record information about all memory contexts of a thread into the threadid_timestamp.log file in the $GAUSSLOG/gs_log/${node_name}/dumpmem directory. threadid can be obtained from sessid in Table 1.

Table 1 PV_SESSION_MEMORY_DETAIL columns

Name

Type

Description

sessid

text

  • When the thread pool is disabled (enable_thread_pool = off), this column indicates the thread start time + session ID (string: timestamp.sessionid).
  • When the thread pool is enabled (enable_thread_pool = on): If the memory context is at the thread level, this column indicates the thread start time + thread ID (string: timestamp.threadid). If the memory context is at the session level, the column indicates the thread start time + session ID (string: timestamp.sessionid).

sesstype

text

Thread name.

contextname

text

Name of the memory context.

level

smallint

Hierarchy of the memory context.

parent

text

Name of the parent memory context.

totalsize

bigint

Total size of the memory context, in bytes.

freesize

bigint

Total size of released memory in the memory context, in bytes.

usedsize

bigint

Size of used memory in the memory context, in bytes. For TempSmallContextGroup, this parameter specifies the number of collected memory contexts.

This view is an O&M view and is used to locate memory problems. Do not query this view concurrently. If you query this view concurrently, the waiting time for new connections increases as the number of concurrent connections increases. As a result, new connections cannot be connected for a long time.