RDS postgres historical performance analysis

Hello,

We understand that RDS- postgres provides many built-in views of performance statistics (pg_stat_statements, pg_stat_activity, along with other views like apg_plan_mgmt.dba_plans, all of which are important for real-time SQL performance troubleshooting. However, these views provide only cumulative statistics. The last database restarts or statistics are reset, and the statistics themselves reside only in memory.

When we need to troubleshoot a performance issue(mainly historical ones), we typically need to review statistics for a particular window or compare statistics between different windows. Mainly to get answers to below questions..

Why is the database running slower today? What has changed in the last 24 hours, last week, or last month?

Are there any sub-optimal SQLs?

Why is this SQL much slower than before? Has its execution plan been changed? Can we find and use a better execution plan?

What happened to the database within a specific, small window of time?

Will a new application release cause any performance issues? Do we need to increase database capacity in terms of CPU and/or IOPS? etc.

To find above , i see multiple opensource extensions available (for example pgsnapper). But i also see “performance insights” tool in the AWS itself provides historical information up to month or so, so my question was that , is it possible to query those underlying views used behind “performance insights” to analyze or debug historical database performance issues as because many times all the required information are not available in the “performance insights” user interface. And being able to query those underlying views will help us diagnosing the issues better.

Create a dashboard using the metrics you want and i think they can be visualised for something like 15 months

Thank You.

I am seeing in the create custom dash board , its having fixed defined “widgets” to add to the dashboard. But if we want to have some analysis like say for example, if the query execution plan got changed over the period of time which has caused the database performance to degraded , so we want to see what exact plan it was taking throughout and when the plan got changed and why it changed etc., I don’t see any option to do that kind of analysis from the performance insights. So do think, that is possible?

Don’t you think , for such kind of on-demand performance analysis, we have to have access to the underlying views of the performance insights, which should be queryable or else we will need some other opensource tool may be which will sample these and persist these data in the database so that it will be manually queryable for doing such kind of analysis?

I think you will need custom metrics - failing that, the type of stored procedure analysis and traceability you require may not be possible on rds