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.