How To See Currently Executing PostgreSQL Queries

IT Support Forum Forums Databases PostgreSQL SQL Queries How To See Currently Executing PostgreSQL Queries

This topic contains 0 replies, has 1 voice, and was last updated by  Webmaster 4 months, 1 week ago.

  • Author
    Posts
  • #1913

    Webmaster
    Keymaster

    To get a list of queries that are currently running in PostgreSQL, run the following SQL query against the database:

    SELECT *
    FROM pg_stat_activity
    WHERE application_name NOT LIKE ‘pgAdmin%’
    AND NOT query = ‘DISCARD ALL’
    AND NOT query = ‘unlisten *’;

    You can also use this to see how long the query has been running by pressing F7.

You must be logged in to reply to this topic.