Thread

  1. how to trace a backend session

    James Pang <jamespang886@gmail.com> — 2024-01-22T07:29:27Z

    experts,
        We migrated our database from Oracle to Postgresql recently, we used to
    turn on Oracle session trace(that will capture all activities, SQL
    statements, waiting, waiting time), to do living troubleshooting.  could
    you direct any similar tracing in Postgresql v13 , v14.
    
    Thanks,
    
    James
    
  2. Re: how to trace a backend session

    pierre.forstmann@gmail.com — 2024-01-23T18:45:05Z

    Hello,
    
    I have coded an extension to trace SQL statements for specific backends:
    https://github.com/pierreforstmann/pg_log_statements
    (only SQL statements are traced - no wait events data is collected).
    
    Pierre
    
    Le lun. 22 janv. 2024 à 08:29, James Pang <jamespang886@gmail.com> a écrit :
    
    > experts,
    >     We migrated our database from Oracle to Postgresql recently, we used
    > to turn on Oracle session trace(that will capture all activities, SQL
    > statements, waiting, waiting time), to do living troubleshooting.  could
    > you direct any similar tracing in Postgresql v13 , v14.
    >
    > Thanks,
    >
    > James
    >
    
  3. Re: how to trace a backend session

    Dominique Devienne <ddevienne@gmail.com> — 2024-01-24T08:16:57Z

    >
    > Le lun. 22 janv. 2024 à 08:29, James Pang <jamespang886@gmail.com> a
    > écrit :
    >
    >> [...] we used to turn on Oracle session trace(that will capture all
    >> activities,
    >>
    > SQL statements, waiting, waiting time), to do living troubleshooting.
    >>
    > could you direct any similar tracing in Postgresql v13 , v14.
    >>
    >
    On Tue, Jan 23, 2024 at 7:45 PM Pierre Forstmann <pierre.forstmann@gmail.com>
    wrote:
    
    > I have coded an extension to trace SQL statements for specific backends:
    > https://github.com/pierreforstmann/pg_log_statements
    > (only SQL statements are traced - no wait events data is collected).
    >
    
    There's also the possibility of activating client-side tracing with libpq,
    if you are using it:
    https://www.postgresql.org/docs/current/libpq-control.html#LIBPQ-PQTRACE
    
    Not the same thing as server-side tracing, of course. But can be useful.
    --DD
    
    PS: Although that trace is not easily machine parse'able, it is at least
    human readable (kinda...)
    (see https://www.spinics.net/lists/pgsql/msg218580.html),