For active queries, PostgreSQL has a "statistics collector" subsystem that collates data on table, server, query, index, and connection activity. The database exposes information through a number of "pg_stat" predefined views and some lower-level statistic functions for power users.
Additionally, there are several system information functions that can extract session and system information on processes and queries that are currently ongoing.
The key tables and functions that I've found useful are:
- pg_stat_activity: A table with one entry per server process, showing details of the running query for each.