How to query time specific performance in postgres? The data in the pg_stat_statements table is really useful for me. I need to know the queries and the time they take. How can I perform a query to pg_stat_statements to get the "total_time" over the last 2 hours? I see no column for this.
I don't know of a canned tool to do this.  But you can easily create a table which has the same columns as pg_stat_statements and an extra timestamptz column, then have a scheduled task take a snapshot of pg_stat_statements into this table every 2 hours.  Then you can take the differences between adjacent snapshots of the same query.