# Monitoring postgres transaction

**URL:** <https://www.ruby-forum.com/t/monitoring-postgres-transaction/127225>\
**Category:** Ruby\
**Created:** [January 26, 2008, 4:05pm UTC](https://www.ruby-forum.com/t/monitoring-postgres-transaction/127225 "2008-01-26T16:05:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![glacius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/dec6dc/32.png) [@glacius](https://www.ruby-forum.com/u/glacius)\
**Post date:** [January 26, 2008, 4:05pm UTC](https://www.ruby-forum.com/t/monitoring-postgres-transaction/127225/1 "2008-01-26T16:05:50Z")

</div>

Hi I would like to monitor postgres transactions in a realtime fashion,  
is  
there a library I can use to help me facilitate this functionality

---

<div class="post-metadata">

**Author:** ![glacius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/dec6dc/32.png) [@glacius](https://www.ruby-forum.com/u/glacius)\
**Post date:** [January 26, 2008, 5:10pm UTC](https://www.ruby-forum.com/t/monitoring-postgres-transaction/127225/2 "2008-01-26T17:10:04Z")

</div>

Gian H. wrote:

> Hi I would like to monitor postgres transactions in a realtime fashion, is  
> there a library I can use to help me facilitate this functionality

Explain what you mean by monitor.

---

<div class="post-metadata">

**Author:** ![glacius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/dec6dc/32.png) [@glacius](https://www.ruby-forum.com/u/glacius)\
**Post date:** [January 26, 2008, 7:16pm UTC](https://www.ruby-forum.com/t/monitoring-postgres-transaction/127225/3 "2008-01-26T19:16:18Z")

</div>

I would like to display queries live

---

<div class="post-metadata">

**Author:** ![glacius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/dec6dc/32.png) [@glacius](https://www.ruby-forum.com/u/glacius)\
**Post date:** [January 26, 2008, 7:26pm UTC](https://www.ruby-forum.com/t/monitoring-postgres-transaction/127225/4 "2008-01-26T19:26:53Z")

</div>

You could use Wireshark to look at the packets going from your  
application to the postgresql server.

Wireshark has a ‘real time’ mode. It also has parsers built-in which  
interpret the bits in each packet.

Bob G

---

<div class="post-metadata">

**Author:** ![glacius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/dec6dc/32.png) [@glacius](https://www.ruby-forum.com/u/glacius)\
**Post date:** [January 26, 2008, 7:45pm UTC](https://www.ruby-forum.com/t/monitoring-postgres-transaction/127225/5 "2008-01-26T19:45:43Z")

</div>

On Sun, 2008-01-27 at 03:26 +0900, Bob G. wrote:

> > I would like to display queries live
> > 
> > > Explain what you mean by monitor.  
> > > While I’m not aware of a ruby library for this, the API for postgresql  
> > > certainly offers support for notifications:

> **[34.9. Asynchronous Notification](https://www.postgresql.org/docs/8.1/libpq-notify.html)**
>
> 34.9. Asynchronous Notification PostgreSQL offers asynchronous notification via the LISTEN and NOTIFY commands. A client session registers its interest in a …

The example linked from that page shows C code that gets notified on  
actions on a particular table.

HTH,

Felix

---

<div class="post-metadata">

**Author:** ![glacius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/dec6dc/32.png) [@glacius](https://www.ruby-forum.com/u/glacius)\
**Post date:** [January 27, 2008, 6:13pm UTC](https://www.ruby-forum.com/t/monitoring-postgres-transaction/127225/6 "2008-01-27T18:13:52Z")

</div>

Gian H. wrote:

> >

With the proper configuration flags turned on, you can query internal  
postgresql  
table(s) for running queries. But, short lived queries will probably be  
in and  
out of the table(s) too fast to be seen.
