Those new to the realm of PostgreSQL from other databases will find little gems sprinkled liberally through the software.  One of those gems is the watch command. It can be used to repeatedly run a query over and over again.

Pretend you are watching the progress of the importation of a CSV file and want to sample the progress every so often.  Before you start the import, type query to sample the incoming data.

To get updates three times a minute, you would then do the following while the import runs.

For MySQL-ers who miss the information from SHOW PROCESSLIST, try instead this combination.  First, check the latest queries from the various sessions.

Then set a fifteen-second timer!

The watch command comes in handy whenever you repetitively need to run a query.

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments