O'Reilly logo

PostgreSQL High Performance Cookbook by Dinesh Kumar, Chitij Chauhan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Monitoring vacuum progress

In this recipe, we will be discussing the usage of the pg_stat_progress_vacuum catalog view, which gives some metrics about the ongoing vacuum process.

Getting ready

PostgreSQL 9.6 introduces a new catalog view, which provides some metrics about the ongoing vacuum processes. This view provides some metrics, along with different action phases, where vacuum/autovacuum performs internally on the table. This view currently does not track the metrics of VACUUM FULL operations, which might be available in future versions.

How to do it...

Let use VACUUM on any sample big table:

benchmarksql=# VACUUM bigtable;

In another terminal, let us query the view and put in the \watch mode, as shown here:

benchmarksql=# SELECT * FROM pg_stat_progress_vacuum; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required