SELECT version, json_content, pg_try_advisory_xact_lock(s.id) as locked, s.id as id FROM snapshots s WHERE ar_id = $1 -- from https://github.com/crabzilla/crabzilla/blob/f66e43ca4d7c119a00fab68c48386aa7672b0e95/crabzilla-engine-postgres/src/main/java/io/github/crabzilla/engine/command/CommandController.kt#L48 -- more at https://hashrocket.com/blog/posts/advisory-locks-in-postgres