1

We have installed pg_repack on our postgresql database.

What is the best way to periodically invoke the pg_repack command using GCP infrastructure?

We tried running it using Cloud Run, but the 1 hour time limit often means that it times out before it can finish.

When it times out, we face the following error on subsequent runs:

WARNING: the table "public.<table name>" already has a trigger called "repack_trigger"
DETAIL: The trigger was probably installed during a previous attempt to run pg_repack on the table which was interrupted and for some reason failed to clean up the temporary objects. Please drop the trigger or drop and recreate the pg_repack extension altogether to remove all the temporary objects left over.

Which forces us to manually recreate the extension.

What is the easiest way to schedule pg_repack without the fear of it timing out? Alternatively, is there a way to gracefully shut down pg_repack, so that we can retry without having to recreate the extension?

0 Answers0