You can perform common memory diagnostics or shared memory diagnostics based on your business requirements.

Common memory

Check the polar_stat_activity_rt view to obtain memory details. The following code provides an example:
SELECT pid, rss
FROM polar_stat_activity_rt 
DESC; \watch 1
Then, you can use the polar_backends_mcxt view to check the memory context that occupies the most memory space in the process.
Note No details about memory contexts of PolarDB O Edition are provided. To further analyze memory context, you must use kernel code or SQL statements.

Shared memory

You can view the distribution of shared memory in the polar_stat_shmem view.