Skip to content
Theory · Locks · lesson 9 of 11

Advisory locks

Every night the chain builds a sales report. The application runs on two servers, and the scheduler on each starts the report at 3:00. Only one of them should build it. There is nothing to lock here: the database has no "nightly report" row.

In this lesson

  • The key and the level
  • What pg_locks shows
  • Run only if nobody is running it
  • Common mistake
  • Key points