1

I'm building an application on Node, Bookshelf and Knex and for learning and performance reasons I'd like to see what queries are being executed live on Postgres.

How can I do it? I'm not paricularly interested in a profiler if that means the queries will be stored on log files. I just want to see what is happening right now.

Possible solutions:

  • An application like the SQL Server profiler, as long as it displays live queries
  • A way to make Bookshelf or Knex to output queries to the console

Unfortunately I searched Google to no avail.

Andre Pena
  • 56,650
  • 48
  • 196
  • 243
  • Possible [duplicate](http://stackoverflow.com/a/8208376/1216680) ? – Houari Mar 25 '16 at 14:13
  • http://chrismiles.info/systemsadmin/databases/articles/viewing-current-postgresql-queries/ – Dennis R Mar 25 '16 at 15:33
  • The libraries you mentioned won't do it, but [pg-promise](https://github.com/vitaly-t/pg-promise) can do it nicely, via [pg-monitor](https://github.com/vitaly-t/pg-monitor). – vitaly-t Mar 25 '16 at 18:46

1 Answers1

1

If you want to see this live information on a tool outside of your application, your best bet is pgAdmin III: connect to the server of interest and then select Tools | Server Status. This, incidentally, will also show you the server log which is extremely useful when building applications because it gives you immediate access to errors at the PG server.

Patrick
  • 29,357
  • 6
  • 62
  • 90