数据仓库服务 GAUSSDB(DWS)-PV_SESSION_MEMORY_DETAIL:应用示例

时间:2024-12-09 15:13:17

应用示例

查询当前节点上所有MemoryContext的使用情况。

根据sessid定位到该MemoryContext是在哪个线程中创建和使用的,依据totalsize,freesize及usedsize来确认内存的使用情况是否符合预期,预先判断是否可能存在内存泄露的风险。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
SELECT * FROM PV_SESSION_MEMORY_DETAIL order by totalsize desc;
           sessid           |        sesstype         |                 contextname                 | level |            parent            | totalsize | freesize | usedsize
----------------------------+-------------------------+---------------------------------------------+-------+------------------------------+-----------+----------+----------
 0.139975915622720          | postmaster              | gs_signal                                   |     1 | TopMemoryContext             |  17209904 |  8081136 |  9128768
 1667462258.139973631031040 | postgres                | SRF multi-call context                      |     5 | FunctionScan_139973631031040 |   1725504 |     3168 |  1722336
 1667461280.139973666686720 | postgres                | CacheMemoryContext                          |     1 | TopMemoryContext             |   1472544 |   284456 |  1188088
 1667450443.139973877479168 | postgres                | CacheMemoryContext                          |     1 | TopMemoryContext             |   1472544 |   356088 |  1116456
 1667462258.139973631031040 | postgres                | CacheMemoryContext                          |     1 | TopMemoryContext             |   1472544 |   128216 |  1344328
 1667461250.139973915236096 | postgres                | CacheMemoryContext                          |     1 | TopMemoryContext             |   1472544 |   226352 |  1246192
 1667450439.139974010144512 | WLMarbiter              | CacheMemoryContext                          |     1 | TopMemoryContext             |   1472544 |   386736 |  1085808
 1667450439.139974151726848 | WDRSnapshot             | CacheMemoryContext                          |     1 | TopMemoryContext             |   1472544 |   159720 |  1312824
 1667450439.139974026925824 | WLMmonitor              | CacheMemoryContext                          |     1 | TopMemoryContext             |   1472544 |   297976 |  1174568
 1667451036.139973746386688 | postgres                | CacheMemoryContext                          |     1 | TopMemoryContext             |   1472544 |   208064 |  1264480
 1667461250.139973950891776 | postgres                | CacheMemoryContext                          |     1 | TopMemoryContext             |   1472544 |   270016 |  1202528
 1667450439.139974076212992 | WLMCalSpaceInfo         | CacheMemoryContext                          |     1 | TopMemoryContext             |   1472544 |   393952 |  1078592
 1667450439.139974092994304 | WLMCollectWorker        | CacheMemoryContext                          |     1 | TopMemoryContext             |   1472544 |    94848 |  1377696
 1667461254.139973971343104 | postgres                | CacheMemoryContext                          |     1 | TopMemoryContext             |   1472544 |   338544 |  1134000
 1667461280.139973822945024 | postgres                | CacheMemoryContext                          |     1 | TopMemoryContext             |   1472544 |   284456 |  1188088
 1667450439.139974202070784 | JobScheduler            | CacheMemoryContext                          |     1 | TopMemoryContext             |   1472544 |   216728 |  1255816
 1667450454.139973860697856 | postgres                | CacheMemoryContext                          |     1 | TopMemoryContext             |   1472544 |   388384 |  1084160
 0.139975915622720          | postmaster              | Postmaster                                  |     1 | TopMemoryContext             |   1004288 |    88792 |   915496
 1667450439.139974218852096 | AutoVacLauncher         | CacheMemoryContext                          |     1 | TopMemoryContext             |    948256 |   183488 |   764768
 1667461250.139973915236096 | postgres                | TempSmallContextGroup                       |     0 |                              |    584448 |   148032 |      119
 1667462258.139973631031040 | postgres                | TempSmallContextGroup                       |     0 |                              |    579712 |   162128 |      123
support.huaweicloud.com/devg-910-dws/dws_04_0852.html