Skip to content

Peak memory usage on Aurora PostgreSQL instance.

0

Hi,

Following these 2 guides: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Database-Insights-Execution-Plans.html https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Monitoring.Query.Plans.html

I would like to add a column into the database insights view in Cloudwatch to track memory usage by query, as it can be done for other parameters retrieved by the aurora_stat_plans() function like "Plans count (unique)", "Blk hits/call" ...etc.

I am aware that this SQL Aurora function actually has 3 columns called total_exec_peakmem, min_exec_peakmem and max_exec_peakmem related to memory usage, but I cannot see any option in the preferences settings to include it into the visual interface in AWS.

How can I achieve this?

Thank you very much.

Regards,

Felipe.

asked a year ago356 views

1 Answer
0

The peak memory usage columns (total_exec_peakmem, min_exec_peakmem, and max_exec_peakmem) are available in the aurora_stat_statements function for Aurora PostgreSQL, but there are a few important considerations:

  1. These peak memory columns are only available in specific Aurora PostgreSQL versions:
  • 16.3 and higher
  • 15.7 and higher
  • 14.12 and higher
  1. The peak memory usage is tracked separately for the planning and execution phases of each query. The function also provides total_plan_peakmem, min_plan_peakmem, and max_plan_peakmem columns.

  2. To use these functions, you need to ensure that the pg_stat_statements extension is enabled and included in the shared_preload_libraries parameter.

Unfortunately, while these memory metrics are available at the database level through the Aurora PostgreSQL functions, there doesn't appear to be a direct way to add these specific memory usage columns to the CloudWatch Database Insights visual interface through the preferences settings.

As an alternative approach, you could:

  1. Query the aurora_stat_statements function directly in your database to monitor peak memory usage
  2. Use CloudWatch to monitor overall memory usage at the instance level
  3. For more detailed memory analysis, consider using Performance Schema and sys schema (though this is more applicable to Aurora MySQL)

The CloudWatch agent cannot be installed on RDS instances since they are managed services, but Amazon RDS automatically sends various metrics to CloudWatch by default.
Sources
Monitoring query execution plans and peak memory for Aurora PostgreSQL - Amazon Aurora
aurora_stat_statements - Amazon Aurora
Is it possible to install and config the CloudWatch agent on an RDS instance? | AWS re:Post

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.